summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-12-23 22:35:58 (GMT)
committerGitHub <noreply@github.com>2022-12-23 22:35:58 (GMT)
commit5d84966cce6c596da22922a07f49bde959ff5201 (patch)
treee44414a0ff5f02233158709844e0932b08f54c63 /Doc/tutorial
parent1ecfd1ebf1f53ef6ac82085b25ed09952b470d4e (diff)
downloadcpython-5d84966cce6c596da22922a07f49bde959ff5201.zip
cpython-5d84966cce6c596da22922a07f49bde959ff5201.tar.gz
cpython-5d84966cce6c596da22922a07f49bde959ff5201.tar.bz2
GH-100425: Improve accuracy of builtin sum() for float inputs (GH-100426)
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/floatingpoint.rst2
1 files changed, 1 insertions, 1 deletions
diff --git a/Doc/tutorial/floatingpoint.rst b/Doc/tutorial/floatingpoint.rst
index e1cd7f9..cedade6 100644
--- a/Doc/tutorial/floatingpoint.rst
+++ b/Doc/tutorial/floatingpoint.rst
@@ -192,7 +192,7 @@ added onto a running total. That can make a difference in overall accuracy
so that the errors do not accumulate to the point where they affect the
final total:
- >>> sum([0.1] * 10) == 1.0
+ >>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0
False
>>> math.fsum([0.1] * 10) == 1.0
True