From: Mariatta Date: Thu, 30 Mar 2017 02:10:22 +0000 (-0700) Subject: bpo-29677: DOC: clarify documentation for `round` (GH-877) (GH-893) X-Git-Tag: v3.5.4rc1~244 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eef6e11f9883f54de491121b8c49fdadd3e3506d;p=python bpo-29677: DOC: clarify documentation for `round` (GH-877) (GH-893) (cherry picked from commit 85deefcf61d3cc192846f41a4ccc6df17da60c98) --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 15413cba94..ff8c7b83bb 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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 @@ -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,