bpo-39288: Add math.nextafter(x, y) (GH-17937)

Return the next floating-point value after x towards y.
diff --git a/Doc/library/math.rst b/Doc/library/math.rst
index 43eaba9..135adf8 100644
--- a/Doc/library/math.rst
+++ b/Doc/library/math.rst
@@ -213,6 +213,14 @@
    of *x* and are floats.
 
 
+.. function:: nextafter(x, y)
+
+   Return the next floating-point value after *x* towards *y*.
+
+   If *x* is equal to *y*, return *y*.
+
+   .. versionadded:: 3.9
+
 .. function:: perm(n, k=None)
 
    Return the number of ways to choose *k* items from *n* items
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 8cfb572..a686d64 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -177,6 +177,13 @@
 :class:`~imaplib.IMAP4_stream` were applied to this change.
 (Contributed by Dong-hee Na in :issue:`38615`.)
 
+math
+----
+
+Add :func:`math.nextafter`: return the next floating-point value after *x*
+towards *y*.
+(Contributed by Victor Stinner in :issue:`39288`.)
+
 nntplib
 -------