--- a/LongFloat.st Wed Jun 18 00:45:36 2003 +0200
+++ b/LongFloat.st Wed Jun 18 01:11:01 2003 +0200
@@ -61,13 +61,45 @@
* no finite(x) ?
* no isnan(x) ?
*/
-# ifndef finite
-# define finite(x) 1
+# ifndef isnanl
+# define isnanl(x) \
+ ((((unsigned int *)(&x))[0] == 0x00000000) && \
+ (((unsigned int *)(&x))[1] == 0xC0000000) && \
+ (((unsigned short *)(&x))[4] == 0xFFFF))
# endif
+
# ifndef isnan
-# define isnan(x) 0
+# define isnan(x) \
+ ((((unsigned int *)(&x))[0] == 0x00000000) && \
+ (((unsigned int *)(&x))[1] == 0xFFF80000))
+# endif
+
+# ifndef isPositiveInfinity
+# define isPositiveInfinity(x) \
+ ((((unsigned int *)(&x))[0] == 0x00000000) && \
+ (((unsigned int *)(&x))[1] == 0x7FF00000))
+# endif
+
+# ifndef isNegativeInfinity
+# define isPositiveInfinity(x) \
+ ((((unsigned int *)(&x))[0] == 0x00000000) && \
+ (((unsigned int *)(&x))[1] == 0xFFF00000))
# endif
-#endif /* WIN32 */
+
+# ifndef isinf
+# define isinf(x) \
+ ((((unsigned int *)(&x))[0] == 0x00000000) && \
+ ((((unsigned int *)(&x))[1] & 0x7FF00000) == 0x7FF00000))
+# endif
+
+# ifndef finite
+# define finite(x) (!isinf(x) && !isnan(x))
+# endif
+
+# define NO_ASINH
+# define NO_ACOSH
+# define NO_ATANH
+#endif
#ifdef realIX
/*
@@ -80,7 +112,9 @@
#ifdef WIN32
# define LONGFLOAT long double
+# define LONG_isnan isnanl
#endif
+
#if defined(__GNUC__)
# define LONGFLOAT long double
# if defined(linux)
@@ -724,8 +758,11 @@
LONGFLOAT fVal;
fVal = __longFloatVal(self);
+#ifdef WIN32
+ if (! isnanl(fVal))
+#endif
if ((fVal >= (LONGFLOAT)_MIN_INT) && (fVal <= (LONGFLOAT)_MAX_INT)) {
- RETURN ( __MKSMALLINT( (INT)fVal) );
+ RETURN ( __MKSMALLINT( (INT)fVal) );
}
%}.
^ super asInteger
@@ -1431,11 +1468,6 @@
#else
double dV = (double) __longFloatVal(self);
- /*
- * notice: on machines which do not provide
- * a finite() macro or function (WIN32),
- * this may always ret true here ...
- */
if (finite(dV)) {
RETURN (true);
} else {
@@ -2260,7 +2292,7 @@
!LongFloat class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.39 2003-06-17 22:36:52 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LongFloat.st,v 1.40 2003-06-17 23:11:01 cg Exp $'
! !
LongFloat initialize!