diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2021-06-12 09:23:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 09:23:02 (GMT) |
commit | 4a42cebf6dd769e2fa4e234a9e91093b3ad1cb63 (patch) | |
tree | 925efc812b8810d8c5fb6c1040307d1cacf4b976 /Doc/whatsnew | |
parent | 3ec3ee7d2e9b45b586e486e429b412d6d0ca530f (diff) | |
download | cpython-4a42cebf6dd769e2fa4e234a9e91093b3ad1cb63.zip cpython-4a42cebf6dd769e2fa4e234a9e91093b3ad1cb63.tar.gz cpython-4a42cebf6dd769e2fa4e234a9e91093b3ad1cb63.tar.bz2 |
bpo-44339: Fix math.pow corner case to comply with IEEE 754 (GH-26606)
Change the behaviour of `math.pow(0.0, -math.inf)` and `math.pow(-0.0, -math.inf)` to return positive infinity instead of raising `ValueError`. This makes `math.pow` consistent with the built-in `pow` (and the `**` operator) for this particular special case, and brings the `math.pow` special-case handling into compliance with IEEE 754.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.11.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index ba7c456..50d91a0 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -96,8 +96,14 @@ string. (Contributed by Sergey B Kirpichev in :issue:`44258`.) math ---- -Add :func:`math.cbrt()`: return the cube root of x. -(Contributed by Ajith Ramachandran in :issue:`44357`.) +* Add :func:`math.cbrt`: return the cube root of x. + (Contributed by Ajith Ramachandran in :issue:`44357`.) + +* The behaviour of two :func:`math.pow` corner cases was changed, for + consistency with the IEEE 754 specification. The operations + ``math.pow(0.0, -math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return + ``inf``. Previously they raised :exc:`ValueError`. (Contributed by Mark + Dickinson in :issue:`44339`.) Removed |