[Numpy-svn] r8624 - trunk/numpy/core/include/numpy

numpy-svn@scip... numpy-svn@scip...
Sat Aug 14 08:43:19 CDT 2010


Author: rgommers
Date: 2010-08-14 08:43:19 -0500 (Sat, 14 Aug 2010)
New Revision: 8624

Modified:
   trunk/numpy/core/include/numpy/npy_math.h
Log:
BUG: workaround for undefined isnan/isinf in VS2008. Closes #1502.

Thanks to Christoph Gohlke.

Modified: trunk/numpy/core/include/numpy/npy_math.h
===================================================================
--- trunk/numpy/core/include/numpy/npy_math.h	2010-08-14 13:42:59 UTC (rev 8623)
+++ trunk/numpy/core/include/numpy/npy_math.h	2010-08-14 13:43:19 UTC (rev 8624)
@@ -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