Mercurial > cpython-lru_cache-weakref
diff Modules/mathmodule.c @ 62494:83ca0ea9ef1f 2.6
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.
........
| author | Mark Dickinson <dickinsm@gmail.com> |
|---|---|
| date | Fri, 25 Jun 2010 20:21:43 +0000 |
| parents | e38335d4df91 |
| children | b36cb4602e21 |
line wrap: on
line diff
--- a/Modules/mathmodule.c Fri Jun 25 00:09:05 2010 +0000 +++ b/Modules/mathmodule.c Fri Jun 25 20:21:43 2010 +0000 @@ -435,17 +435,17 @@ 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
