diff options
author | Mariatta <Mariatta@users.noreply.github.com> | 2017-03-30 02:10:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-30 02:10:07 (GMT) |
commit | 2609c9ee78c53d501914a5a90dbe094d9a8c3c97 (patch) | |
tree | 6eae54042e11456fe34fe8f7b0ca2d71fc06196e /Doc/library | |
parent | 346dcd65e6b832a35b4cfc15b7309b51a38e9ca2 (diff) | |
download | cpython-2609c9ee78c53d501914a5a90dbe094d9a8c3c97.zip cpython-2609c9ee78c53d501914a5a90dbe094d9a8c3c97.tar.gz cpython-2609c9ee78c53d501914a5a90dbe094d9a8c3c97.tar.bz2 |
bpo-29677: DOC: clarify documentation for `round` (GH-877) (GH-892)
(cherry picked from commit 85deefcf61d3cc192846f41a4ccc6df17da60c98)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/functions.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 2c0ea71..90fb07a 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1254,9 +1254,9 @@ are always available. They are listed here in alphabetical order. .. function:: round(number[, ndigits]) - Return the floating point value *number* rounded to *ndigits* digits after - the decimal point. If *ndigits* is omitted or is ``None``, it returns the - nearest integer to its input. Delegates to ``number.__round__(ndigits)``. + Return *number* rounded to *ndigits* precision after the decimal + point. If *ndigits* is omitted or is ``None``, it returns the + nearest integer to its input. 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 @@ -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, otherwise of the same type as *number*. + For a general Python object ``number``, ``round(number, ndigits)`` delegates to + ``number.__round__(ndigits)``. + .. note:: The behavior of :func:`round` for floats can be surprising: for example, |