Math Functions
math.nextafter()
Move from x toward y by the requested number of representable floating-point steps. The keyword steps was added in 3.12; zero steps preserve x.
Formal Syntax & Structure
python syntaxpython
math.nextafter(x, y, /, *, steps=1)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | real number | Input real value. |
| y | real number | Second real value. |
| steps | int | Nonnegative number of representable steps toward y. |
Return Value
float
Floating-point result; finite precision and domain restrictions apply.
Working Example
Example Snippetpython
import mathprint(math.nextafter(1.0, 2.0))