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

diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 135adf8..c9f2a38 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -219,6 +219,13 @@
 
    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)