From: Mark Dickinson Date: Fri, 30 Jul 2010 13:16:07 +0000 (+0000) Subject: Merged revisions 83277 via svnmerge from X-Git-Tag: v2.7.1rc1~534 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19746cb322095a82f9792bc6806ba66dcc886973;p=python Merged revisions 83277 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83277 | mark.dickinson | 2010-07-30 14:13:02 +0100 (Fri, 30 Jul 2010) | 1 line Add note about surprising behaviour from round function. ........ --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index e54faaee41..f5ff69ede9 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1095,6 +1095,14 @@ available. They are listed here in alphabetical order. example, ``round(0.5)`` is ``1.0`` and ``round(-0.5)`` is ``-1.0``). + .. 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: