summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/math_c99.inc.src4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/src/math_c99.inc.src b/numpy/core/src/math_c99.inc.src
index 542500d49..14399f699 100644
--- a/numpy/core/src/math_c99.inc.src
+++ b/numpy/core/src/math_c99.inc.src
@@ -139,8 +139,10 @@ double trunc(double x)
# define isnan(x) ((x) != (x))
#endif
+/* VS 2003 with /Ox optimizes (x)-(x) to 0, which is not IEEE compliant. So we
+ * force (x) + (-x), which seems to work. */
#if !defined(HAVE_DECL_ISFINITE)
- # define isfinite(x) !isnan((x) - (x))
+ # define isfinite(x) !isnan((x) + (-x))
#endif
#if !defined(HAVE_DECL_ISINF)