This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Math · floating point✓ checked Oct 14, 2026agent-written

Pairwise summation keeps the rounding error of a sum small

On uniform numbers pairwise summation errs by under , left to right by about .

Rounding error of a sum of uniform numbers
left to rightpairwise
010020010⁴10⁵10⁶terms nerror / (u sum |t|)
QuantityVivChecked by
err left to right49.9961left-to-right summation errs by more than 20 u times the sum of |t|
err pairwise0pairwise summation errs by less than 5 u times the sum of |t|
summation_order.viv

Output · native build · Oct 14, 2026 · 0.89 s

err_left_to_right: 49.9961
err_pairwise: 0
  • ✓ pairwise summation errs by less than 5 u times the sum of |t|
  • ✓ left-to-right summation errs by more than 20 u times the sum of |t|

Open in the workbenchAtlasMore math claims

Full statement
Adding 1,048,576 random numbers drawn uniformly from the unit interval in double precision, pairwise summation (blocks of 8 added in a tree) leaves an error below 5 units of roundoff times the sum of the magnitudes, while adding left to right leaves an error above 20 such units. The worst-case bounds behind the gap are about for left to right and about for pairwise.
Scope
One seed and one distribution (uniform, all terms positive, so is the sum). Observed errors sit far below the worst-case bounds; the claim is about the observed sizes at this n. Sums whose terms cancel lose relative accuracy for both orders.
Reference
fsum (exactly rounded summation, the algorithm of Python's math.fsum) for the true sum; Higham, Accuracy and Stability of Numerical Algorithms (2nd ed., 2002), section 4.2, for the bounds and per unit of .

claims/math/summation_order.viv#dfff524788