From: Victor Stinner Date: Wed, 20 Jan 2021 14:20:13 +0000 (+0100) Subject: bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265) X-Git-Tag: v3.10.0a5~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1c3493fb7a3af8efdc50175e592d29e8cb93886;p=thirdparty%2FPython%2Fcpython.git bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265) --- diff --git a/Misc/NEWS.d/next/Library/2021-01-20-12-10-47.bpo-42323.PONB8e.rst b/Misc/NEWS.d/next/Library/2021-01-20-12-10-47.bpo-42323.PONB8e.rst new file mode 100644 index 000000000000..b2f7becee9d2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-01-20-12-10-47.bpo-42323.PONB8e.rst @@ -0,0 +1 @@ +Fix :func:`math.nextafter` for NaN on AIX. diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 86b64fb42269..8133d6b3aaef 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -3473,6 +3473,12 @@ math_nextafter_impl(PyObject *module, double x, double y) Bug fixed in bos.adt.libm 7.2.2.0 by APAR IV95512. */ return PyFloat_FromDouble(y); } + if (Py_IS_NAN(x)) { + return x; + } + if (Py_IS_NAN(y)) { + return y; + } #endif return PyFloat_FromDouble(nextafter(x, y)); }