mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Issue #26512: Clarify Integral; tidy up table of rounding functions
Based on patch by Julien.
This commit is contained in:
parent
ad1fd346b2
commit
129fe04d4d
2 changed files with 20 additions and 17 deletions
|
@ -361,19 +361,22 @@ Notes:
|
||||||
All :class:`numbers.Real` types (:class:`int` and :class:`float`) also include
|
All :class:`numbers.Real` types (:class:`int` and :class:`float`) also include
|
||||||
the following operations:
|
the following operations:
|
||||||
|
|
||||||
+--------------------+------------------------------------+--------+
|
+--------------------+---------------------------------------------+
|
||||||
| Operation | Result | Notes |
|
| Operation | Result |
|
||||||
+====================+====================================+========+
|
+====================+=============================================+
|
||||||
| ``math.trunc(x)`` | *x* truncated to Integral | |
|
| :func:`math.trunc(\| *x* truncated to :class:`~numbers.Integral` |
|
||||||
+--------------------+------------------------------------+--------+
|
| x) <math.trunc>` | |
|
||||||
| ``round(x[, n])`` | *x* rounded to n digits, | |
|
+--------------------+---------------------------------------------+
|
||||||
| | rounding half to even. If n is | |
|
| :func:`round(x[, | *x* rounded to *n* digits, |
|
||||||
| | omitted, it defaults to 0. | |
|
| n]) <round>` | rounding half to even. If *n* is |
|
||||||
+--------------------+------------------------------------+--------+
|
| | omitted, it defaults to 0. |
|
||||||
| ``math.floor(x)`` | the greatest integral float <= *x* | |
|
+--------------------+---------------------------------------------+
|
||||||
+--------------------+------------------------------------+--------+
|
| :func:`math.floor(\| the greatest :class:`~numbers.Integral` |
|
||||||
| ``math.ceil(x)`` | the least integral float >= *x* | |
|
| x) <math.floor>` | <= *x* |
|
||||||
+--------------------+------------------------------------+--------+
|
+--------------------+---------------------------------------------+
|
||||||
|
| :func:`math.ceil(x)| the least :class:`~numbers.Integral` >= *x* |
|
||||||
|
| <math.ceil>` | |
|
||||||
|
+--------------------+---------------------------------------------+
|
||||||
|
|
||||||
For additional numeric operations see the :mod:`math` and :mod:`cmath`
|
For additional numeric operations see the :mod:`math` and :mod:`cmath`
|
||||||
modules.
|
modules.
|
||||||
|
|
|
@ -957,8 +957,8 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(math_ceil_doc,
|
PyDoc_STRVAR(math_ceil_doc,
|
||||||
"ceil(x)\n\nReturn the ceiling of x as an int.\n"
|
"ceil(x)\n\nReturn the ceiling of x as an Integral.\n"
|
||||||
"This is the smallest integral value >= x.");
|
"This is the smallest integer >= x.");
|
||||||
|
|
||||||
FUNC2(copysign, copysign,
|
FUNC2(copysign, copysign,
|
||||||
"copysign(x, y)\n\nReturn a float with the magnitude (absolute value) "
|
"copysign(x, y)\n\nReturn a float with the magnitude (absolute value) "
|
||||||
|
@ -997,8 +997,8 @@ static PyObject * math_floor(PyObject *self, PyObject *number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(math_floor_doc,
|
PyDoc_STRVAR(math_floor_doc,
|
||||||
"floor(x)\n\nReturn the floor of x as an int.\n"
|
"floor(x)\n\nReturn the floor of x as an Integral.\n"
|
||||||
"This is the largest integral value <= x.");
|
"This is the largest integer <= x.");
|
||||||
|
|
||||||
FUNC1A(gamma, m_tgamma,
|
FUNC1A(gamma, m_tgamma,
|
||||||
"gamma(x)\n\nGamma function at x.")
|
"gamma(x)\n\nGamma function at x.")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue