Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 85deefc

Browse files
csabellaMariatta
authored andcommitted
bpo-29677: DOC: clarify documentation for round (GH-877)
1 parent a90e64b commit 85deefc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Doc/library/functions.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,9 +1254,9 @@ are always available. They are listed here in alphabetical order.
12541254

12551255
.. function:: round(number[, ndigits])
12561256

1257-
Return the floating point value *number* rounded to *ndigits* digits after
1258-
the decimal point. If *ndigits* is omitted or is ``None``, it returns the
1259-
nearest integer to its input. Delegates to ``number.__round__(ndigits)``.
1257+
Return *number* rounded to *ndigits* precision after the decimal
1258+
point. If *ndigits* is omitted or is ``None``, it returns the
1259+
nearest integer to its input.
12601260

12611261
For the built-in types supporting :func:`round`, values are rounded to the
12621262
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.
12661266
negative). The return value is an integer if called with one argument,
12671267
otherwise of the same type as *number*.
12681268

1269+
For a general Python object ``number``, ``round(number, ndigits)`` delegates to
1270+
``number.__round__(ndigits)``.
1271+
12691272
.. note::
12701273

12711274
The behavior of :func:`round` for floats can be surprising: for example,

0 commit comments

Comments
 (0)