]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add note about surprising behaviour from round function.
authorMark Dickinson <dickinsm@gmail.com>
Fri, 30 Jul 2010 13:13:02 +0000 (13:13 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Fri, 30 Jul 2010 13:13:02 +0000 (13:13 +0000)
Doc/library/functions.rst

index 8a413f4bc81a3dc853b6f783aed91d7ea78dc3d2..5c21f34a3f1327cd9697b9e8edd0a6921e161b4d 100644 (file)
@@ -972,6 +972,13 @@ are always available.  They are listed here in alphabetical order.
    The return value is an integer if called with one argument, otherwise of the
    same type as *x*.
 
+   .. note::
+
+      The behavior of :func:`round` for floats can be surprising: for example,
+      ``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``.
+      This is not a bug: it's a result of the fact that most decimal fractions
+      can't be represented exactly as a float.  See :ref:`tut-fp-issues` for
+      more information.
 
 .. function:: set([iterable])
    :noindex: