summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorananthan-123 <ananthakrishnan15.2001@gmail.com>2020-02-19 18:21:37 (GMT)
committerGitHub <noreply@github.com>2020-02-19 18:21:37 (GMT)
commitf2ee21d858bc03dd801b97afe60ee2ea289e2fe9 (patch)
tree7a35d8b02a53df4505d275b67bc56462cda33619 /Modules/clinic
parent4dee92b0ad9f4e3ea2fbbbb5253340801bb92dc7 (diff)
downloadcpython-f2ee21d858bc03dd801b97afe60ee2ea289e2fe9.zip
cpython-f2ee21d858bc03dd801b97afe60ee2ea289e2fe9.tar.gz
cpython-f2ee21d858bc03dd801b97afe60ee2ea289e2fe9.tar.bz2
bpo-39479:Add math.lcm() function: Least Common Multiple (#18547)
* Update math.rst * Update math.rst * updated whats new * Update test_math.py * Update mathmodule.c * Update mathmodule.c.h * Update ACKS * 📜🤖 Added by blurb_it. * Update 3.9.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update math.rst * Update 2020-02-18-12-37-16.bpo-39479.j3UcCq.rst * Update test_math.py * Update ACKS * Update mathmodule.c.h * Update mathmodule.c * Update mathmodule.c.h * Update mathmodule.c.h Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/mathmodule.c.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h
index f95d291..df45a1a 100644
--- a/Modules/clinic/mathmodule.c.h
+++ b/Modules/clinic/mathmodule.c.h
@@ -85,6 +85,36 @@ PyDoc_STRVAR(math_factorial__doc__,
#define MATH_FACTORIAL_METHODDEF \
{"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
+PyDoc_STRVAR(math_lcm__doc__,
+"lcm($module, x, y, /)\n"
+"--\n"
+"\n"
+"least common multiple of x and y");
+
+#define MATH_LCM_METHODDEF \
+ {"lcm", (PyCFunction)(void(*)(void))math_lcm, METH_FASTCALL, math_lcm__doc__},
+
+static PyObject *
+math_lcm_impl(PyObject *module, PyObject *a, PyObject *b);
+
+static PyObject *
+math_lcm(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *a;
+ PyObject *b;
+
+ if (!_PyArg_CheckPositional("lcm", nargs, 2, 2)) {
+ goto exit;
+ }
+ a = args[0];
+ b = args[1];
+ return_value = math_lcm_impl(module, a, b);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(math_trunc__doc__,
"trunc($module, x, /)\n"
"--\n"
@@ -895,4 +925,4 @@ math_ulp(PyObject *module, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=9b51d215dbcac060 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=f8daa185c043a7b7 input=a9049054013a1b77]*/