aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 86b64fb4226..8133d6b3aae 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));
}