dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support test_float.c,1.3,1.4


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support test_float.c,1.3,1.4
Date: Mon, 09 Dec 2002 03:59:05 -0500

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv1944/support

Modified Files:
        test_float.c 
Log Message:


Work around bugs in "isinf" on platforms that incorrectly return
1 for negative infinity.


Index: test_float.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/test_float.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_float.c        15 May 2002 06:43:08 -0000      1.3
--- test_float.c        9 Dec 2002 08:59:01 -0000       1.4
***************
*** 63,66 ****
--- 63,92 ----
  }
  
+ int ILNativeFloatIsInf(ILNativeFloat value)
+ {
+       /* Note: some platforms have a broken "isinf" that returns 1
+          for both negative and positive infinity.  The code below
+          attempts to correct for this bug */
+ #ifdef HAVE_ISINF
+       if(isinf(value) == 0)
+       {
+               return 0;
+       }
+ #else
+       if(ILNativeFloatIsNaN(value) || ILNativeFloatIsFinite(value))
+       {
+               return 0;
+       }
+ #endif
+       if(value < (ILNativeFloat)0.0)
+       {
+               return -1;
+       }
+       else
+       {
+               return 1;
+       }
+ }
+ 
  #ifdef        __cplusplus
  };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]