summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/mathmodule.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/mathmodule.c.h')
-rw-r--r--Modules/clinic/mathmodule.c.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index 95d68ee..f34633c 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -808,4 +808,52 @@ math_comb(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=9a2b3dc91eb9aadd input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(math_nextafter__doc__,
+"nextafter($module, x, y, /)\n"
+"--\n"
+"\n"
+"Return the next floating-point value after x towards y.");
+
+#define MATH_NEXTAFTER_METHODDEF \
+ {"nextafter", (PyCFunction)(void(*)(void))math_nextafter, METH_FASTCALL, math_nextafter__doc__},
+
+static PyObject *
+math_nextafter_impl(PyObject *module, double x, double y);
+
+static PyObject *
+math_nextafter(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ double x;
+ double y;
+
+ if (!_PyArg_CheckPositional("nextafter", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (PyFloat_CheckExact(args[0])) {
+ x = PyFloat_AS_DOUBLE(args[0]);
+ }
+ else
+ {
+ x = PyFloat_AsDouble(args[0]);
+ if (x == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
+ }
+ if (PyFloat_CheckExact(args[1])) {
+ y = PyFloat_AS_DOUBLE(args[1]);
+ }
+ else
+ {
+ y = PyFloat_AsDouble(args[1]);
+ if (y == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
+ }
+ return_value = math_nextafter_impl(module, x, y);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=e4ed1a800e4b2eae input=a9049054013a1b77]*/