STINNER Victor <vstin...@python.org> added the comment:
Ah, I saw an error on POWER6 AIX 3.x ("POWER6 (aka ppc64-be) using (GCC) 4.7.4"): https://buildbot.python.org/all/#/builders/119/builds/175 The following test fails: self.assertEqualSign(math.nextafter(-0.0, +0.0), +0.0) Well, C code specific to AIX can be added to nextafter() to handle this corner case: diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 81d871786f..82ffb4c3d1 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -3287,7 +3287,16 @@ static PyObject * math_nextafter_impl(PyObject *module, double x, double y) /*[clinic end generated code: output=750c8266c1c540ce input=02b2d50cd1d9f9b6]*/ { - double f = nextafter(x, y); + double f; +#if defined(_AIX) + if (x == y) { + f = y; + } + else +#endif + { + f = nextafter(x, y); + } return PyFloat_FromDouble(f); } Another option is to not make the assumption on the libc nextafter() and handle x==y the same way on all platforms. Error: ====================================================================== FAIL: test_nextafter (test.test_math.IsCloseTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_math.py", line 2040, in test_nextafter self.assertEqualSign(math.nextafter(-0.0, +0.0), +0.0) File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_math.py", line 2018, in assertEqualSign self.assertEqual(math.copysign(1.0, x), math.copysign(1.0, y)) AssertionError: -1.0 != 1.0 Same error in test_cmath: ====================================================================== FAIL: test_nextafter (test.test_cmath.IsCloseTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_math.py", line 2040, in test_nextafter self.assertEqualSign(math.nextafter(-0.0, +0.0), +0.0) File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_math.py", line 2018, in assertEqualSign self.assertEqual(math.copysign(1.0, x), math.copysign(1.0, y)) AssertionError: -1.0 != 1.0 ---------- components: +Tests nosy: +mark.dickinson title: AIX: math.nextafter(a, b) breaks AIX bot -> AIX: self.assertEqualSign(math.nextafter(-0.0, +0.0), +0.0) test fails on AIX _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39396> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com