Float.st
changeset 25057 70f0a503674f
parent 25047 df44d7be428f
child 25059 f3093a33e1e1
--- a/Float.st	Tue Dec 03 19:50:56 2019 +0100
+++ b/Float.st	Tue Dec 03 19:51:11 2019 +0100
@@ -149,10 +149,23 @@
 	 ((((unsigned int *)(&x))[1] & 0x7FF00000) == 0x7FF00000))
 # endif
 
+# ifndef isnanf
+#  define isnanf(x)      \
+	((((unsigned int *)(&x))[0] & 0x7FC00000) == 0x7FC00000)
+# endif
 # ifndef isfinite
 #  define isfinite(x) (!isinf(x) && !isnan(x))
 # endif
 
+# ifndef isinff
+#  define isinff(x)      \
+	((((unsigned int *)(&x))[0] & 0x7FFFFFFF) == 0x7F800000)
+# endif
+
+# ifndef isfinitef
+#  define isfinitef(x) (!isinff(x) && !isnanf(x))
+# endif
+
 # define NO_ASINH
 # define NO_ACOSH
 # define NO_ATANH
@@ -1486,7 +1499,7 @@
     double dVal = __floatVal(self);
     float fVal = (float)dVal;
 
-    if (isfinite(fVal) || !isfinite(dVal)) {
+    if (isfinitef(fVal) || !isfinite(dVal)) {
 	__qMKSFLOAT(newFloat, fVal);
 	RETURN ( newFloat );
     }
@@ -3671,7 +3684,8 @@
 
 integerAndFractionParts
     "return the integer and the fraction part of the receiver as a pair
-     of flaots (i.e. the result of the modf function)"
+     of floats (i.e. the result of the modf function).
+     Adding the parts gives the original value"
 
     |integerPart fractionPart|