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

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

[Dotgnu-pnet-commits] CVS: pnet/engine cvm.c,1.39,1.40 cvm_arith.c,1.12


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/engine cvm.c,1.39,1.40 cvm_arith.c,1.12,1.13 cvm_compare.c,1.9,1.10 cvm_conv.c,1.22,1.23 lib_math.c,1.4,1.5
Date: Mon, 09 Dec 2002 03:59:05 -0500

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

Modified Files:
        cvm.c cvm_arith.c cvm_compare.c cvm_conv.c lib_math.c 
Log Message:


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


Index: cvm.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** cvm.c       24 Jun 2002 05:54:37 -0000      1.39
--- cvm.c       9 Dec 2002 08:59:00 -0000       1.40
***************
*** 27,43 ****
  #include "ffi.h"
  #endif
- #ifdef IL_CONFIG_FP_SUPPORTED
- #ifdef HAVE_MATH_H
- #include <math.h>
- #endif
- #ifdef HAVE_IEEEFP_H
- #include <ieeefp.h>
- #endif
- #ifdef IL_NATIVE_WIN32
- #include <float.h>
- #define isnan(value)  _isnan((value))
- #define HAVE_ISNAN 1
- #endif
- #endif /* IL_CONFIG_FP_SUPPORTED */
  
  #ifdef        __cplusplus
--- 27,30 ----

Index: cvm_arith.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_arith.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** cvm_arith.c 18 Jun 2002 02:07:21 -0000      1.12
--- cvm_arith.c 9 Dec 2002 08:59:00 -0000       1.13
***************
*** 22,43 ****
  
  /*
-  * Check to see if a floating point number is finite.
-  */
- #ifdef hpux
-       #define FLOAT_IS_FINITE(value)  (isfinite((value)))
- #else /* !hpux */
-       #ifdef HAVE_FINITE
-               #define FLOAT_IS_FINITE(value)  (finite((value)))
-       #else /* !HAVE_FINITE */
-               #if defined(HAVE_ISNAN) && defined(HAVE_ISINF)
-                       #define FLOAT_IS_FINITE(value)  (!isnan((value)) && \
-                                                                               
          isinf((value)) == 0)
-               #else
-                       #error "Don't know how to determine if floating point 
numbers are finite"
-               #endif
-       #endif /* !HAVE_FINITE */
- #endif /* !hpux */
- 
- /*
   * Integer add with overflow detection.
   */
--- 22,25 ----
***************
*** 2152,2156 ****
  {
        /* Check the top-most float value to see if it is finite */
!       if(FLOAT_IS_FINITE(ReadFloat(&(stacktop[-CVM_WORDS_PER_NATIVE_FLOAT]))))
        {
                MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
--- 2134,2139 ----
  {
        /* Check the top-most float value to see if it is finite */
!       if(ILNativeFloatIsFinite
!                       (ReadFloat(&(stacktop[-CVM_WORDS_PER_NATIVE_FLOAT]))))
        {
                MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);

Index: cvm_compare.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_compare.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** cvm_compare.c       11 Jun 2002 04:00:19 -0000      1.9
--- cvm_compare.c       9 Dec 2002 08:59:00 -0000       1.10
***************
*** 72,76 ****
        ILNativeFloat tempa = ReadFloat(a);
        ILNativeFloat tempb = ReadFloat(b);
!       if(isnan(tempa) || isnan(tempb))
        {
                return nanResult;
--- 72,76 ----
        ILNativeFloat tempa = ReadFloat(a);
        ILNativeFloat tempb = ReadFloat(b);
!       if(ILNativeFloatIsNaN(tempa) || ILNativeFloatIsNaN(tempb))
        {
                return nanResult;

Index: cvm_conv.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_conv.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** cvm_conv.c  30 Jun 2002 10:39:50 -0000      1.22
--- cvm_conv.c  9 Dec 2002 08:59:00 -0000       1.23
***************
*** 125,129 ****
  {
        ILNativeFloat value = ReadFloat(posn);
!       if(FLOAT_IS_FINITE(value))
        {
                if(value > (ILNativeFloat)(-2147483649.0) &&
--- 125,129 ----
  {
        ILNativeFloat value = ReadFloat(posn);
!       if(ILNativeFloatIsFinite(value))
        {
                if(value > (ILNativeFloat)(-2147483649.0) &&
***************
*** 143,147 ****
  {
        ILNativeFloat value = ReadFloat(posn);
!       if(FLOAT_IS_FINITE(value))
        {
                if(value >= (ILNativeFloat)0.0 &&
--- 143,147 ----
  {
        ILNativeFloat value = ReadFloat(posn);
!       if(ILNativeFloatIsFinite(value))
        {
                if(value >= (ILNativeFloat)0.0 &&

Index: lib_math.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_math.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** lib_math.c  1 Apr 2002 05:23:22 -0000       1.4
--- lib_math.c  9 Dec 2002 08:59:00 -0000       1.5
***************
*** 29,34 ****
  #ifdef IL_NATIVE_WIN32
  #include <float.h>
- #define isnan(value)  _isnan((value))
- #define HAVE_ISNAN 1
  #endif
  
--- 29,32 ----
***************
*** 82,148 ****
   * Test for "not a number".
   */
! #ifdef HAVE_ISNAN
!       #define Math_IsNaN(x)           (isnan((x)))
! #else
!       #define Math_IsNaN(x)           ((x) != (x))
! #endif
  
  /*
   * Test for infinities.
   */
! #ifdef        HAVE_ISINF
!       #define Math_IsInf(x)           (isinf((x)))
! #else /* !HAVE_ISINF */
!       #ifdef  HAVE_FINITE
!               static IL_INLINE int IsInfDouble(ILDouble x)
!               {
!                       if(finite(x))
!                       {
!                               return 0;
!                       }
!                       else if(x < (ILDouble)0.0)
!                       {
!                               return -1;
!                       }
!                       else
!                       {
!                               return 1;
!                       }
!               }
!       #else   /* !HAVE_FINITE */
!               static int IsInfDouble(ILDouble x)
!               {
!                       unsigned char buf[8];
!                       ILUInt32 test;
!                       IL_WRITE_DOUBLE(buf, (ILDouble)x);
!                       test = IL_READ_UINT32(buf + 4);
!                       if((test & (ILUInt32)0x7FF80000) == 
(ILUInt32)0x7FF00000)
!                       {
!                               if((test & (ILUInt32)0x80000000) != 0)
!                               {
!                                       return -1;
!                               }
!                               else
!                               {
!                                       return 1;
!                               }
!                       }
!                       else
!                       {
!                               return 0;
!                       }
!               }
!       #endif  /* !HAVE_FINITE */
!       #define Math_IsInf(x)   (IsInfDouble((ILDouble)(x)))
! #endif        /* !HAVE_ISINF */
  
  /*
   * Test for finite values.
   */
! #ifdef HAVE_FINITE
!       #define Math_Finite(x)  (finite((x)))
! #else
!       #define Math_Finite(x)  (!Math_IsNaN((x)) && Math_IsInf((x)) == 0)
! #endif
  
  /*
--- 80,94 ----
   * Test for "not a number".
   */
! #define       Math_IsNaN(x)                   (ILNativeFloatIsNaN((x)))
  
  /*
   * Test for infinities.
   */
! #define       Math_IsInf(x)                   (ILNativeFloatIsInf((x)))
  
  /*
   * Test for finite values.
   */
! #define       Math_Finite(x)                  (ILNativeFloatIsFinite((x)))
  
  /*




reply via email to

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