[Python-checkins] bpo-39288: Add examples to math.nextafter() documentation (GH-17962)

Victor Stinner webhook-mailer at python.org
Sun Jan 12 06:57:52 EST 2020

commit: 54cfbb2feee1f7328c3d6799ec3734b00824b555
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-01-12T12:57:47+01:00

bpo-39288: Add examples to math.nextafter() documentation (GH-17962)

M Doc/library/math.rst

diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 135adf8f6362d..c9f2a383312f3 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -219,6 +219,13 @@ Number-theoretic and representation functions
    If *x* is equal to *y*, return *y*.
+   Examples:
+   * ``math.nextafter(x, math.inf)`` goes up: towards positive infinity.
+   * ``math.nextafter(x, -math.inf)`` goes down: towards minus infinity.
+   * ``math.nextafter(x, 0.0)`` goes towards zero.
+   * ``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero.
    .. versionadded:: 3.9
 .. function:: perm(n, k=None)

More information about the Python-checkins mailing list