]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39288: Add examples to math.nextafter() documentation (GH-17962)
authorVictor Stinner <vstinner@python.org>
Sun, 12 Jan 2020 11:57:47 +0000 (12:57 +0100)
committerGitHub <noreply@github.com>
Sun, 12 Jan 2020 11:57:47 +0000 (12:57 +0100)
Doc/library/math.rst

index 135adf8f6362d5b9242ceb940baf8fac09aace38..c9f2a383312f396a93f7f426e4c5082c4b94a0a9 100644 (file)
@@ -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)