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

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

`

1254

1254

``

1255

1255

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

`

1256

1256

``

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.

`

1260

1260

``

1261

1261

`` For the built-in types supporting :func:round, values are rounded to the

``

1262

1262

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

`

1266

1266

` negative). The return value is an integer if called with one argument,

`

1267

1267

` otherwise of the same type as number.

`

1268

1268

``

``

1269


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

``

1270


 ``number.__round__(ndigits)``.

``

1271

+

1269

1272

` .. note::

`

1270

1273

``

1271

1274

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

``