[Numpy-svn] r8630 - branches/1.5.x/numpy/core/include/numpy

numpy-svn@scip... numpy-svn@scip...
Sat Aug 14 08:57:21 CDT 2010


Author: rgommers
Date: 2010-08-14 08:57:21 -0500 (Sat, 14 Aug 2010)
New Revision: 8630

Modified:
   branches/1.5.x/numpy/core/include/numpy/npy_math.h
Log:
BUG: (backport of r8624) workaround for undefined isnan/isinf in VS2008. Closes #1502.

Thanks to Christoph Gohlke.

Modified: branches/1.5.x/numpy/core/include/numpy/npy_math.h
===================================================================
--- branches/1.5.x/numpy/core/include/numpy/npy_math.h	2010-08-14 13:57:01 UTC (rev 8629)
+++ branches/1.5.x/numpy/core/include/numpy/npy_math.h	2010-08-14 13:57:21 UTC (rev 8630)
@@ -147,11 +147,19 @@
 #ifndef NPY_HAVE_DECL_ISNAN
     #define npy_isnan(x) ((x) != (x))
 #else
-    #define npy_isnan(x) isnan((x))
+    #ifdef _MSC_VER
+        #define npy_isnan(x) _isnan((x))
+    #else
+        #define npy_isnan(x) isnan((x))
+    #endif
 #endif
 
 #ifndef NPY_HAVE_DECL_ISFINITE
-    #define npy_isfinite(x) !npy_isnan((x) + (-x))
+    #ifdef _MSC_VER
+        #define npy_isfinite(x) _finite((x))
+    #else
+        #define npy_isfinite(x) !npy_isnan((x) + (-x))
+    #endif
 #else
     #define npy_isfinite(x) isfinite((x))
 #endif
@@ -159,7 +167,11 @@
 #ifndef NPY_HAVE_DECL_ISINF
     #define npy_isinf(x) (!npy_isfinite(x) && !npy_isnan(x))
 #else
-    #define npy_isinf(x) isinf((x))
+    #ifdef _MSC_VER
+        #define npy_isinf(x) (!_finite((x)) && !_isnan((x)))
+    #else
+        #define npy_isinf(x) isinf((x))
+    #endif
 #endif
 
 #ifndef NPY_HAVE_DECL_SIGNBIT



More information about the Numpy-svn mailing list