summaryrefslogtreecommitdiffstats
path: root/Modules/mathmodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-06-25 20:23:41 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-06-25 20:23:41 (GMT)
commitb76207138ac0ac132e5675f209956e9852e7c6b1 (patch)
tree070b11ddb8148c6988c1606ebed685d07b3f5bdb /Modules/mathmodule.c
parent4af2c15e5f145f3d9e646952d87dbaf9ffa453d0 (diff)
downloadcpython-b76207138ac0ac132e5675f209956e9852e7c6b1.zip
cpython-b76207138ac0ac132e5675f209956e9852e7c6b1.tar.gz
cpython-b76207138ac0ac132e5675f209956e9852e7c6b1.tar.bz2
Merged revisions 82223 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r82223 | mark.dickinson | 2010-06-25 21:22:24 +0100 (Fri, 25 Jun 2010) | 9 lines Merged revisions 82221 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r82221 | mark.dickinson | 2010-06-25 21:19:48 +0100 (Fri, 25 Jun 2010) | 1 line Fix indentation of Python code example in C comment. ........ ................
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 50dd43e..05bad5d 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -490,17 +490,17 @@ _fsum_realloc(double **p_ptr, Py_ssize_t n,
def msum(iterable):
partials = [] # sorted, non-overlapping partial sums
for x in iterable:
- i = 0
- for y in partials:
- if abs(x) < abs(y):
- x, y = y, x
- hi = x + y
- lo = y - (hi - x)
- if lo:
- partials[i] = lo
- i += 1
- x = hi
- partials[i:] = [x]
+ i = 0
+ for y in partials:
+ if abs(x) < abs(y):
+ x, y = y, x
+ hi = x + y
+ lo = y - (hi - x)
+ if lo:
+ partials[i] = lo
+ i += 1
+ x = hi
+ partials[i:] = [x]
return sum_exact(partials)
Rounded x+y stored in hi with the roundoff stored in lo. Together hi+lo