Welcome to the CHICKEN Scheme pasting service

specialisation patch for C_u_i_fpintegerp added by C-Keen on Fri Mar 16 11:53:45 2012

commit b0445c6e497c175c2dee96948630a10b7a4c4aac (HEAD, refs/heads/master)
Author: Christian Kellermann <ckeen@pestilenz.org>
Date:   Fri Mar 16 11:35:57 2012 +0100

    Check for isnan & isinf in C_u_i_fpintegerp

	Modified chicken.h
diff --git a/chicken.h b/chicken.h
index 9237e14..cd73152 100644
--- a/chicken.h
+++ b/chicken.h
@@ -2182,9 +2182,13 @@ C_inline C_word C_i_rationalp(C_word x)
 
 C_inline C_word C_u_i_fpintegerp(C_word x)
 {
-  double dummy;
+  double dummy, val;
+
+  val = C_flonum_magnitude(x);
 
-  return C_mk_bool(C_modf(C_flonum_magnitude(x), &dummy) == 0.0);
+  if(C_isnan(val) || C_isinf(val)) return C_SCHEME_FALSE;
+
+  return C_mk_bool(C_modf(val, &dummy) == 0.0);
 }
 
 

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the procedure that returns the car of a car?
Visually impaired? Let me spell it for you (wav file) download WAV