mirror of
https://github.com/python/cpython.git
synced 2025-08-15 06:10:47 +00:00
[3.13] gh-133904: Fix math.factorial
documentation (GH-133907) (#133922)
* [3.13] gh-133904: Fix `math.factorial` documentation (GH-133907)
(cherry picked from commit 27ed64575d
)
Co-authored-by: mkaraev <maruf.karaev97@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
8e923f3659
commit
532acbd0fa
3 changed files with 4 additions and 9 deletions
|
@ -144,8 +144,7 @@ Number-theoretic functions
|
||||||
|
|
||||||
.. function:: factorial(n)
|
.. function:: factorial(n)
|
||||||
|
|
||||||
Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not integral or
|
Return factorial of the nonnegative integer *n*.
|
||||||
is negative.
|
|
||||||
|
|
||||||
.. versionchanged:: 3.10
|
.. versionchanged:: 3.10
|
||||||
Floats with integral values (like ``5.0``) are no longer accepted.
|
Floats with integral values (like ``5.0``) are no longer accepted.
|
||||||
|
|
6
Modules/clinic/mathmodule.c.h
generated
6
Modules/clinic/mathmodule.c.h
generated
|
@ -54,9 +54,7 @@ PyDoc_STRVAR(math_factorial__doc__,
|
||||||
"factorial($module, n, /)\n"
|
"factorial($module, n, /)\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Find n!.\n"
|
"Find n!.");
|
||||||
"\n"
|
|
||||||
"Raise a ValueError if x is negative or non-integral.");
|
|
||||||
|
|
||||||
#define MATH_FACTORIAL_METHODDEF \
|
#define MATH_FACTORIAL_METHODDEF \
|
||||||
{"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
|
{"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__},
|
||||||
|
@ -1011,4 +1009,4 @@ math_ulp(PyObject *module, PyObject *arg)
|
||||||
exit:
|
exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
/*[clinic end generated code: output=755da3b1dbd9e45f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=9fe02dc4af07c1e0 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -2009,13 +2009,11 @@ math.factorial
|
||||||
/
|
/
|
||||||
|
|
||||||
Find n!.
|
Find n!.
|
||||||
|
|
||||||
Raise a ValueError if x is negative or non-integral.
|
|
||||||
[clinic start generated code]*/
|
[clinic start generated code]*/
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
math_factorial(PyObject *module, PyObject *arg)
|
math_factorial(PyObject *module, PyObject *arg)
|
||||||
/*[clinic end generated code: output=6686f26fae00e9ca input=713fb771677e8c31]*/
|
/*[clinic end generated code: output=6686f26fae00e9ca input=366cc321df3d4773]*/
|
||||||
{
|
{
|
||||||
long x, two_valuation;
|
long x, two_valuation;
|
||||||
int overflow;
|
int overflow;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue