encyclopegia.org

Summation algorithm

A summation algorithm is an algorithm that computes the sum of a finite list of numbers \sum L[i] . It is especially relevant in floating-point arithmetic where the associative property (a+b)+c=a+(b+c) does not hold like it does in (mathematical) real numbers, rational numbers, fixed-point numbers, and unsigned integers, so that the order of calculation can affect the final result. A closely related problem is the calculation of dot products, both of which have numerous proposed algorithms that differ in terms of simplicity, speed (single-thread and parallelized), and accuracy.

A summation algorithm is an algorithm that computes the sum of a finite list of numbers \sum L[i] . It is especially relevant in floating-point arithmetic where the associative property (a+b)+c=a+(b+c) does not hold like it does in (mathematical) real numbers, rational numbers, fixed-point numbers, and unsigned integers, so that the order of calculation can affect the final result. A closely related problem is the calculation of dot products, both of which have numerous proposed algorithms that differ in terms of simplicity, speed (single-thread and parallelized), and accuracy. More concretely, the summation operator "+" of floating-point arithmetic is correctly-rounded, i.e. it has to match the rounding mode currently set. In the case of the two "to nearest" modes, the error is guaranteed to be ≤ 0.5 ulp, and for the other modes ≤ 1 ulp; in all cases, it is deterministic. A ulp is a unit in the last place: the magnitude difference represented by the last digit of the mantissa changing from a 0 to 1, and its own magnitude is determined by the exponent. The error incurred by floating-point rules, relative to the ideal of infinite-precision arithmetic, is called the roundoff error. For the basic case of calculating a+b versus its floating-point version a \oplus b , an algorithm called 2Sum gives both s := a \oplus b and the exact error t = a + b - (a \oplus b) . 2Sum forms the basis of many accurate summation algorithms. The intrinsic sensitivity of a summation problem to errors, regardless of how it is computed, is called its condition number and is defined as \kappa(L) = \sum |L_i| / |\sum L_i| . The inherent error from machine precision is notated as \varepsilon . var sum = 0.0 for i = 1 to L.length do sum = sum + L[i] return sum The worst-case error for a list L of length n is O(n\,\varepsilon\kappa(L)) , corresponding to a case where the rounding errors all add up in the same direction. The average error, corresponding to a random walk of roundoff errors, is O\left(\sqrt{n}\,\varepsilon\kappa(L) \right) . Naive summation also has a batched version, blocked summation, which entails dividing L into a number of smaller lists, summing each of them naively, then summing the sums naively. This is usually done to allow parallel computation. It also reduces the error growth by a factor of 1/b. On the other extreme of speed-accuracy tradeoff, the correctly-rounded \sum L[i] may be computed. Naively this may be done via arbitrary-precision arithmetic, but more efficient methods exist: Shewchuk's method, an adaptive method making use of Floating-point expansions. This can take anywhere from linear (optimistic, and near typical) to quadratic time complexity and anywhere from constant to linear space complexity. Kirchner and Kulisch's superaccumulator method, which only uses integer arithmetic. a hardware implementation was described by Müller, Rüb and Rülling. Zhu and Hayes's HybridSum, which splits into different accumulators by the floating-point exponent field. Uses iFastSum (below) for the final sum. Neal's xsum, two superaccumulator methods optimized for 64-bit processors. Integer-only for the main phase of accumulation. The small superaccumulator is 67 64-bit integers covering the whole exponent range, with carry-propagation so it can act like a 2176-bit integer. The large superaccumulator, used when the array is very large, collects a partial sum for every possible combination of exponent bits and sign bit to ease the load on the small superaccumulator. Zhu and Hayes's iFastSum, a "distillation" method that performs multiple passes of compensated summation. var sum = 0.0 var c = 0.0 for i = 1 to input.length do var y = input[i] + c (sum,c) = 2Sum(sum,y) next i return sum The typical error bound is O(\varepsilon\kappa(L)) . Compensated summation can be made parallel by using a conversion similar to the change from naive to block summation: split the list into several (m) pieces, compute a small number of sub-sums using the compensated method in parallel, then sum them up together using the regular compensated method. Depending on the nature of the data, a mixture of summation methods can be used. For example, the FABsum ("fast and accurate block summation") uses a block structure, also dividing te input into m pieces. The m sub-sums are to be generated using a fast method such as the naive one. The sub-sums are then added together using a more accurate method. The error bound is (b+1) u+O( u^2) , where b is the block size (i.e. m=\left\lceil n/b \right\rceil ) and u is the unit roundoff ( O(\varepsilon\kappa(L)) ). As a result, a reasonable block size such as 128 or 256 can end up doing the great majority of the summations in a "fast" way, while achieving a constant error magnitude comparable to compensated summation. ==External links== Floating-point Summation, Dr. Dobb's Journal September, 1996

References

No reference rows published for this article.

Cite this article

MLA

"Summation algorithm." encyclopegia.org, 2026, https://encyclopegia.org/wiki/summation-algorithm. Accessed 24 November 2026.

Chicago

"Summation algorithm." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/summation-algorithm.

APA

encyclopegia.org. (2026). Summation algorithm. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/summation-algorithm

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Near East Air Transport

enwiki · references available

Audrey Dussutour

enwiki · references available

Owen Parfitt

enwiki · references available

2016–17 VVV-Venlo season

enwiki · references available

Yves Castagnet

enwiki · references available

Villaggio ANIC

enwiki · references available

Jorge Silva Somarriva

enwiki · references available

Maurice Harvey (racing driver)

enwiki · references available

Lautaro Rosas

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1376136689 · 0.5 · snapshot enwiki-001376136689

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.