Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44b0e76 commit 3363e1cCopy full SHA for 3363e1c
2 files changed
Misc/NEWS.d/next/Library/2021-12-09-00-44-42.bpo-46018.hkTI7v.rst
@@ -0,0 +1 @@
1
+Ensure that :func:`math.expm1` does not raise on underflow.
Modules/mathmodule.c
@@ -985,9 +985,13 @@ is_error(double x)
985
* On some platforms (Ubuntu/ia64) it seems that errno can be
986
* set to ERANGE for subnormal results that do *not* underflow
987
* to zero. So to be safe, we'll ignore ERANGE whenever the
988
- * function result is less than one in absolute value.
+ * function result is less than 1.5 in absolute value.
989
+ *
990
+ * bpo-46018: Changed to 1.5 to ensure underflows in expm1()
991
+ * are correctly detected, since the function may underflow
992
+ * toward -1.0 rather than 0.0.
993
*/
- if (fabs(x) < 1.0)
994
+ if (fabs(x) < 1.5)
995
result = 0;
996
else
997
PyErr_SetString(PyExc_OverflowError,
0 commit comments