[Python-checkins] r83277 - python/branches/py3k/Doc/library/functions.rst
mark.dickinson
python-checkins at python.org
Fri Jul 30 15:13:02 CEST 2010
Author: mark.dickinson
Date: Fri Jul 30 15:13:02 2010
New Revision: 83277
Log:
Add note about surprising behaviour from round function.
Modified:
python/branches/py3k/Doc/library/functions.rst
Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst (original)
+++ python/branches/py3k/Doc/library/functions.rst Fri Jul 30 15:13:02 2010
@@ -972,6 +972,13 @@
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:
More information about the Python-checkins
mailing list