Skip to content

Commit c1c3493

Browse files
authored
bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265)
1 parent 7dc71c4 commit c1c3493

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :func:`math.nextafter` for NaN on AIX.

Modules/mathmodule.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,12 @@ math_nextafter_impl(PyObject *module, double x, double y)
34733473
Bug fixed in bos.adt.libm 7.2.2.0 by APAR IV95512. */
34743474
return PyFloat_FromDouble(y);
34753475
}
3476+
if (Py_IS_NAN(x)) {
3477+
return x;
3478+
}
3479+
if (Py_IS_NAN(y)) {
3480+
return y;
3481+
}
34763482
#endif
34773483
return PyFloat_FromDouble(nextafter(x, y));
34783484
}

0 commit comments

Comments
 (0)