bpo-29677: DOC: clarify documentation for `round` (GH-877) · python/cpython@85deefc

@@ -1254,9 +1254,9 @@ are always available. They are listed here in alphabetical order.

1254125412551255

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

125612561257-

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.

1260126012611261

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*.

126812681269+

For a general Python object ``number``, ``round(number, ndigits)`` delegates to

1270+

``number.__round__(ndigits)``.

1271+12691272

.. note::

1270127312711274

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