Skip to content

bpo-45584: Clarify the meaning of truncate in documentation #29183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 2, 2022
18 changes: 10 additions & 8 deletions Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Number-theoretic and representation functions
.. function:: ceil(x)

Return the ceiling of *x*, the smallest integer greater than or equal to *x*.
If *x* is not a float, delegates to ``x.__ceil__()``, which should return an
:class:`~numbers.Integral` value.
If *x* is not a float, delegates to :meth:`x.__ceil__ <object.__ceil__>`,
which should return an :class:`~numbers.Integral` value.


.. function:: comb(n, k)
Expand Down Expand Up @@ -77,9 +77,9 @@ Number-theoretic and representation functions

.. function:: floor(x)

Return the floor of *x*, the largest integer less than or equal to *x*.
If *x* is not a float, delegates to ``x.__floor__()``, which should return an
:class:`~numbers.Integral` value.
Return the floor of *x*, the largest integer less than or equal to *x*. If
*x* is not a float, delegates to :meth:`x.__floor__ <object.__floor__>`, which
should return an :class:`~numbers.Integral` value.


.. function:: fmod(x, y)
Expand Down Expand Up @@ -298,9 +298,11 @@ Number-theoretic and representation functions

.. function:: trunc(x)

Return the :class:`~numbers.Real` value *x* truncated to an
:class:`~numbers.Integral` (usually an integer). Delegates to
:meth:`x.__trunc__() <object.__trunc__>`.
Return *x* with the fractional part
removed, leaving the integer part. This rounds toward 0: ``trunc()`` is
equivalent to :func:`floor` for positive *x*, and equivalent to :func:`ceil`
for negative *x*. If *x* is not a float, delegates to :meth:`x.__trunc__
<object.__trunc__>`, which should return an :class:`~numbers.Integral` value.

.. function:: ulp(x)

Expand Down