mirror of
https://github.com/python/cpython.git
synced 2025-10-27 16:57:08 +00:00
gh-94906: Support multiple steps in math.nextafter (#103881)
This PR updates `math.nextafter` to add a new `steps` argument. The behaviour is as though `math.nextafter` had been called `steps` times in succession. --------- Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
This commit is contained in:
parent
c3f43bfb4b
commit
6e39fa1955
10 changed files with 223 additions and 18 deletions
|
|
@ -224,11 +224,11 @@ Number-theoretic and representation functions
|
|||
of *x* and are floats.
|
||||
|
||||
|
||||
.. function:: nextafter(x, y)
|
||||
.. function:: nextafter(x, y, steps=1)
|
||||
|
||||
Return the next floating-point value after *x* towards *y*.
|
||||
Return the floating-point value *steps* steps after *x* towards *y*.
|
||||
|
||||
If *x* is equal to *y*, return *y*.
|
||||
If *x* is equal to *y*, return *y*, unless *steps* is zero.
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -239,6 +239,9 @@ Number-theoretic and representation functions
|
|||
|
||||
See also :func:`math.ulp`.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
Added the *steps* argument.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
|
||||
.. function:: perm(n, k=None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue