You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: consider using more accurate algorithm for sum() of floating-point values #1281
Python 3.16.0a0 (heads/main:ee68f5f46a1, Aug 12 2026, 11:19:39) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> xs = [1.0,1e200,1.0,-1e200]
>>> sum(xs)
2.0
>>> res = xs[0]
... for t in xs[1:]:
... res += t
... res # naive result
...
0.0
vs
Python 3.13.14 (Thu Sep 17 18:51:21 UTC 2026)
[Graal, Oracle GraalVM, Java 25.0.4.1.1 (amd64)] on 'linux'
Type "help", "copyright", "credits" or "license" for more information.
>>> sum([1.0,1e200,1.0,-1e200])
0.0
Activity