mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-29677: DOC: clarify documentation for round
(GH-877)
This commit is contained in:
parent
a90e64b78d
commit
85deefcf61
1 changed files with 6 additions and 3 deletions
|
@ -1254,9 +1254,9 @@ are always available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
.. function:: round(number[, ndigits])
|
.. function:: round(number[, ndigits])
|
||||||
|
|
||||||
Return the floating point value *number* rounded to *ndigits* digits after
|
Return *number* rounded to *ndigits* precision after the decimal
|
||||||
the decimal point. If *ndigits* is omitted or is ``None``, it returns the
|
point. If *ndigits* is omitted or is ``None``, it returns the
|
||||||
nearest integer to its input. Delegates to ``number.__round__(ndigits)``.
|
nearest integer to its input.
|
||||||
|
|
||||||
For the built-in types supporting :func:`round`, values are rounded to the
|
For the built-in types supporting :func:`round`, values are rounded to the
|
||||||
closest multiple of 10 to the power minus *ndigits*; if two multiples are
|
closest multiple of 10 to the power minus *ndigits*; if two multiples are
|
||||||
|
@ -1266,6 +1266,9 @@ are always available. They are listed here in alphabetical order.
|
||||||
negative). The return value is an integer if called with one argument,
|
negative). The return value is an integer if called with one argument,
|
||||||
otherwise of the same type as *number*.
|
otherwise of the same type as *number*.
|
||||||
|
|
||||||
|
For a general Python object ``number``, ``round(number, ndigits)`` delegates to
|
||||||
|
``number.__round__(ndigits)``.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The behavior of :func:`round` for floats can be surprising: for example,
|
The behavior of :func:`round` for floats can be surprising: for example,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue