summaryrefslogtreecommitdiff
path: root/Modules/mathmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-01-21 11:14:10 +0100
committerGitHub <noreply@github.com>2020-01-21 11:14:10 +0100
commit85ead4fc62829cb7ef2eb0af1a2933282f58c629 (patch)
tree06cb54b4f26b0f8131868cd76a60500889e692dd /Modules/mathmodule.c
parentec64640a2c5236d7a5d5470d759172a3d93eab0b (diff)
downloadcpython-git-85ead4fc62829cb7ef2eb0af1a2933282f58c629.tar.gz
bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)
Move also math.nextafter() on math.ulp() tests from IsCloseTests to MathTests.
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 81d871786f..f012b51d86 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -3287,8 +3287,14 @@ static PyObject *
math_nextafter_impl(PyObject *module, double x, double y)
/*[clinic end generated code: output=750c8266c1c540ce input=02b2d50cd1d9f9b6]*/
{
- double f = nextafter(x, y);
- return PyFloat_FromDouble(f);
+#if defined(_AIX)
+ if (x == y) {
+ /* On AIX 7.1, libm nextafter(-0.0, +0.0) returns -0.0.
+ Bug fixed in bos.adt.libm 7.2.2.0 by APAR IV95512. */
+ return PyFloat_FromDouble(y);
+ }
+#endif
+ return PyFloat_FromDouble(nextafter(x, y));
}