summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-12-13 16:46:37 -0700
committerGitHub <noreply@github.com>2021-12-13 16:46:37 -0700
commit43c113dd7aa36ef833315035858ea98a7b4732c5 (patch)
tree33676812618ec4a8c67f63e7e3ffdca824dfd2e1
parent12d0c6a7096a9b666f6f2951e71776eed3a1ade5 (diff)
parent391737f8568890f9dcd89bd83f7616ce2081e563 (diff)
downloadnumpy-43c113dd7aa36ef833315035858ea98a7b4732c5.tar.gz
Merge pull request #20553 from DWesl/use-cygwin-hypotl-cabsl
BLD: Use the new hypotl on Cygwin, rather than defaulting to npy_hypot
-rw-r--r--numpy/core/src/common/npy_config.h12
-rw-r--r--numpy/core/tests/test_scalarmath.py21
2 files changed, 29 insertions, 4 deletions
diff --git a/numpy/core/src/common/npy_config.h b/numpy/core/src/common/npy_config.h
index fd0f1855c..b01eca5ab 100644
--- a/numpy/core/src/common/npy_config.h
+++ b/numpy/core/src/common/npy_config.h
@@ -136,11 +136,23 @@
#undef HAVE_CPOWL
#undef HAVE_CEXPL
+#include <cygwin/version.h>
+#if CYGWIN_VERSION_DLL_MAJOR < 3003
+/* https://cygwin.com/pipermail/cygwin-announce/2021-October/010268.html */
/* Builtin abs reports overflow */
#undef HAVE_CABSL
#undef HAVE_HYPOTL
#endif
+#if CYGWIN_VERSION_DLL_MAJOR < 3002
+/* https://cygwin.com/pipermail/cygwin-announce/2021-March/009987.html */
+/* Segfault */
+#undef HAVE_MODFL
+/* sqrt(-inf) returns -inf instead of -nan */
+#undef HAVE_SQRTL
+#endif
+#endif
+
/* Disable broken gnu trig functions */
#if defined(HAVE_FEATURES_H)
#include <features.h>
diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py
index 90078a2ea..8a77eca00 100644
--- a/numpy/core/tests/test_scalarmath.py
+++ b/numpy/core/tests/test_scalarmath.py
@@ -4,6 +4,7 @@ import warnings
import itertools
import operator
import platform
+from distutils.version import LooseVersion as _LooseVersion
import pytest
from hypothesis import given, settings, Verbosity
from hypothesis.strategies import sampled_from
@@ -680,17 +681,29 @@ class TestAbs:
@pytest.mark.parametrize("dtype", floating_types + complex_floating_types)
def test_builtin_abs(self, dtype):
- if sys.platform == "cygwin" and dtype == np.clongdouble:
+ if (
+ sys.platform == "cygwin" and dtype == np.clongdouble and
+ (
+ _LooseVersion(platform.release().split("-")[0])
+ < _LooseVersion("3.3.0")
+ )
+ ):
pytest.xfail(
- reason="absl is computed in double precision on cygwin"
+ reason="absl is computed in double precision on cygwin < 3.3"
)
self._test_abs_func(abs, dtype)
@pytest.mark.parametrize("dtype", floating_types + complex_floating_types)
def test_numpy_abs(self, dtype):
- if sys.platform == "cygwin" and dtype == np.clongdouble:
+ if (
+ sys.platform == "cygwin" and dtype == np.clongdouble and
+ (
+ _LooseVersion(platform.release().split("-")[0])
+ < _LooseVersion("3.3.0")
+ )
+ ):
pytest.xfail(
- reason="absl is computed in double precision on cygwin"
+ reason="absl is computed in double precision on cygwin < 3.3"
)
self._test_abs_func(np.abs, dtype)