summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-09-07 14:54:41 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-09-07 14:54:41 -0600
commite20a54b72cb2c8a15cba3e6fe5c2045fdf5286c9 (patch)
tree09c92004bd0c0455519c37c827b83ae0daa8742b /numpy
parent089cc017cdc0b8105d40d74eae15539b1e309e01 (diff)
downloadnumpy-e20a54b72cb2c8a15cba3e6fe5c2045fdf5286c9.tar.gz
BUG: Fix UFUNC_CHECK_STATUS to work on both 32 and 64 bit Windows.
Patch is due to Christolph Gohlke.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/include/numpy/ufuncobject.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h
index aab336da8..423fbc279 100644
--- a/numpy/core/include/numpy/ufuncobject.h
+++ b/numpy/core/include/numpy/ufuncobject.h
@@ -365,11 +365,21 @@ typedef struct _loop1d_info {
#include <float.h>
- /* Clear the floating point exception default of Borland C++ */
+/* Clear the floating point exception default of Borland C++ */
#if defined(__BORLANDC__)
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
#endif
+#if defined(_WIN64)
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus = (int) _clearfp(); \
+ \
+ ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ }
+#else
/* windows enables sse on 32 bit, so check both flags */
#define UFUNC_CHECK_STATUS(ret) { \
int fpstatus, fpstatus2; \
@@ -382,6 +392,7 @@ typedef struct _loop1d_info {
| ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
| ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
}
+#endif
/* Solaris --------------------------------------------------------*/
/* --------ignoring SunOS ieee_flags approach, someone else can