diff options
author | Michael Droettboom <mdboom@gmail.com> | 2018-03-20 21:51:50 -0400 |
---|---|---|
committer | Michael Droettboom <mdboom@gmail.com> | 2018-03-20 21:51:50 -0400 |
commit | 6480ccb32bd4eed7fd43cb604fd683c84966327a (patch) | |
tree | 37905764d5a57074a165d246a8749287484afd8e | |
parent | 517f4c0749f83488d25493ccea62b91caa03c2d6 (diff) | |
download | python-numpy-6480ccb32bd4eed7fd43cb604fd683c84966327a.tar.gz python-numpy-6480ccb32bd4eed7fd43cb604fd683c84966327a.tar.bz2 python-numpy-6480ccb32bd4eed7fd43cb604fd683c84966327a.zip |
Fix SQRT_MIN for platforms with 8-byte long double
-rw-r--r-- | numpy/core/src/npymath/npy_math_complex.c.src | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/core/src/npymath/npy_math_complex.c.src b/numpy/core/src/npymath/npy_math_complex.c.src index ea784ec5b..cf427dad8 100644 --- a/numpy/core/src/npymath/npy_math_complex.c.src +++ b/numpy/core/src/npymath/npy_math_complex.c.src @@ -1526,9 +1526,13 @@ const npy_float SQRT_MIN = 1.0842022e-19f; const npy_double SQRT_MIN = 1.4916681462400413e-154; /* sqrt(DBL_MIN) */ #endif #if @precision@ == 3 +#if NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE +const npy_longdouble SQRT_MIN = 1.4916681462400413e-154; /* sqrt(DBL_MIN) */ +#else /* this is correct for 80 bit long doubles */ const npy_longdouble SQRT_MIN = 1.8336038675548471656e-2466l; #endif +#endif /* Avoid underflow when y is small. */ if (y < SQRT_MIN) { return (x * x); |