Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions 9 Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1233,9 +1233,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
Expand All @@ -1245,6 +1245,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,
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.