diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2015-08-02 22:31:12 +0200 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-08-03 11:38:44 -0600 |
commit | 3ea9cc72aca9d74a360a11fb8cb57a8cf71055d2 (patch) | |
tree | 53e73543f65f510b0c3c651e316132c6e450707b | |
parent | fbf9bff63a27cdb00d8e73e39e0f9495a2e8238d (diff) | |
download | numpy-3ea9cc72aca9d74a360a11fb8cb57a8cf71055d2.tar.gz |
BLD: fix issue with POWL for Intel compilers on Windows.
Thanks to Intel (contact: Yolanda Chen) for this patch.
The Intel “powl” on Windows only supports 80 bits longdouble to keep
compatibility with Microsoft VC.
Microsoft VC only support 64 bits longdouble, from “C:\Program Files
(x86)\Microsoft Visual Studio 11.0\VC\include\math.h”, powl is redefined as:
#define powl(x,y) ((long double)pow((double)(x), (double)(y)))
However in npy_math.c (generated from npy_math.c.src), this definition is
undefined even though HAVE_POWL is set for the Intel C compilers.
At line 384 of npy_math.c.src, we have::
#ifdef @kind@@c@
#undef @kind@@c@
#endif
#ifndef HAVE_@KIND@@C@
@type@ npy_@kind@@c@(@type@ x, @type@ y)
{
return (@type@) npy_@kind@((double)x, (double) y);
}
#endif
The expanded function generated in “npy_math.c” will look like::
#ifdef powl
#undef powl
#endif
#ifndef HAVE_POWL
npy_longdouble npy_powl(npy_longdouble x, npy_longdouble y)
{
return (npy_longdouble) npy_pow((double)x, (double) y);
}
#endif
-rw-r--r-- | numpy/core/src/npymath/npy_math_private.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/npymath/npy_math_private.h b/numpy/core/src/npymath/npy_math_private.h index 5dd55e3bc..7e699321e 100644 --- a/numpy/core/src/npymath/npy_math_private.h +++ b/numpy/core/src/npymath/npy_math_private.h @@ -540,4 +540,11 @@ typedef union { } __npy_clongdouble_to_c99_cast; #endif /* !NPY_USE_C99_COMPLEX */ +/* Intel C for Windows uses POW for 64 bits longdouble*/ +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) +#if defined(HAVE_POWL) && (NPY_SIZEOF_LONGDOUBLE == 8) +#undef HAVE_POWL +#endif +#endif /* _MSC_VER and __INTEL_COMPILER */ + #endif /* !_NPY_MATH_PRIVATE_H_ */ |