summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-26 20:10:50 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-26 20:10:50 (GMT)
commitf0320c7ee6863eb359bbfce7f69420dedefb8538 (patch)
treebd1b0feceba9d7453caf7f0d6ec4a9bf3191cec4 /Doc
parentce95e5646bdd1b74b6f02386b2dfac87b666fc23 (diff)
downloadcpython-f0320c7ee6863eb359bbfce7f69420dedefb8538.zip
cpython-f0320c7ee6863eb359bbfce7f69420dedefb8538.tar.gz
cpython-f0320c7ee6863eb359bbfce7f69420dedefb8538.tar.bz2
Remove the round() discussion which is now out-of-date.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tutorial/floatingpoint.rst19
1 files changed, 2 insertions, 17 deletions
diff --git a/Doc/tutorial/floatingpoint.rst b/Doc/tutorial/floatingpoint.rst
index f060e69..78dc1d6 100644
--- a/Doc/tutorial/floatingpoint.rst
+++ b/Doc/tutorial/floatingpoint.rst
@@ -108,23 +108,8 @@ reproduce *x*, but the output may be more pleasant to look at::
It's important to realize that this is, in a real sense, an illusion: you're
simply rounding the *display* of the true machine value.
-Other surprises follow from this one. For example, after seeing ::
-
- >>> format(0.1, '.17g')
- '0.10000000000000001'
-
-you may be tempted to use the :func:`round` function to chop it back to the
-single digit you expect. But that makes no difference::
-
- >>> format(round(0.1, 1), '.17g')
- '0.10000000000000001'
-
-The problem is that the binary floating-point value stored for "0.1" was already
-the best possible binary approximation to 1/10, so trying to round it again
-can't make it better: it was already as good as it gets.
-
-Another consequence is that since 0.1 is not exactly 1/10, summing ten values of
-0.1 may not yield exactly 1.0, either::
+One illusion may beget another. For example, since 0.1 is not exactly 1/10,
+summing ten values of 0.1 may not yield exactly 1.0, either::
>>> sum = 0.0
>>> for i in range(10):