diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-07-30 13:13:02 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-07-30 13:13:02 (GMT) |
commit | c4fbcdc4c80eb733f923b1c9a5a5c52399acb958 (patch) | |
tree | 2aeb84a53915ef28d77bfb9d22eb860214b6371a | |
parent | 7410dd11ef4d6f6953f690d304158cd53b357cb2 (diff) | |
download | cpython-c4fbcdc4c80eb733f923b1c9a5a5c52399acb958.zip cpython-c4fbcdc4c80eb733f923b1c9a5a5c52399acb958.tar.gz cpython-c4fbcdc4c80eb733f923b1c9a5a5c52399acb958.tar.bz2 |
Add note about surprising behaviour from round function.
-rw-r--r-- | Doc/library/functions.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 8a413f4..5c21f34 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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: |