diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/math.rst | 7 | ||||
-rw-r--r-- | Doc/whatsnew/3.11.rst | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 7aa543a..7118678 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -409,7 +409,7 @@ Power and logarithmic functions .. function:: pow(x, y) Return ``x`` raised to the power ``y``. Exceptional cases follow - Annex 'F' of the C99 standard as far as possible. In particular, + the IEEE 754 standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite, ``x`` is negative, and ``y`` is not an integer then ``pow(x, y)`` @@ -419,6 +419,11 @@ Power and logarithmic functions its arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` function for computing exact integer powers. + .. versionchanged:: 3.11 + The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were + changed to return ``inf`` instead of raising :exc:`ValueError`, + for consistency with IEEE 754. + .. function:: sqrt(x) 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 |