summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorrgommers <ralf.gommers@googlemail.com>2010-08-14 13:43:19 +0000
committerrgommers <ralf.gommers@googlemail.com>2010-08-14 13:43:19 +0000
commitfe3a17a297d593fed2980f311477b0e021e32262 (patch)
tree8007906290ad32f613bd8e7d6530364f1d6d565e /numpy
parent6037fd4b0ebe2627bbcc0b3b131635a05ac073a6 (diff)
downloadnumpy-fe3a17a297d593fed2980f311477b0e021e32262.tar.gz
BUG: workaround for undefined isnan/isinf in VS2008. Closes #1502.
Thanks to Christoph Gohlke.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/npy_math.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/numpy/core/include/numpy/npy_math.h b/numpy/core/include/numpy/npy_math.h
index d53900e19..abdb34d21 100644
--- a/numpy/core/include/numpy/npy_math.h
+++ b/numpy/core/include/numpy/npy_math.h
@@ -147,11 +147,19 @@ double npy_spacing(double x);
#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 @@ double npy_spacing(double x);
#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