Numerical analysis Basic notions and error analysis Theorem
Kahan summation algorithm
Builds on Floating-point arithmeticMachine epsilonRound-off errorBackward error analysis
Statement
Let be numbers in a binary floating-point system with rounding to nearest and unit roundoff (see machine epsilon). Assume that no overflow or underflow occurs. The Kahan summation algorithm computes as follows, in floating-point operations: start with and ; for set , , , ; finally . Then and hence
Remarks
The variable holds the low-order part lost when is added to the large running sum . The difference recovers what was actually added, and subtracting gives minus the round-off error of the addition. This correction is fed back into the next term. The proof tracks the rounding errors of the four operations through the loop; the key point is that, in binary arithmetic, captures the rounding error of almost exactly. For comparison, plain recursive summation only gives the bound , which grows linearly in . The result is a backward error bound: is the exact sum of the slightly perturbed terms . The relative error can still be large when , that is, when the sum is ill-conditioned. Optimizing compilers that treat floating-point addition as associative can simplify to and destroy the method.
Going deeper
For a student
The bound should be compared with the bound , , for recursive summation and for pairwise summation. Compensated summation costs four floating-point operations per term instead of one, but removes the dependence on from the leading term. It is the simplest example of an error-free transformation: the pair represents exactly or nearly exactly. The same idea underlies compensated algorithms for dot products and polynomial evaluation.
Reading path
To understand this page from the ground up, read these 5 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Backward error analysis concept
- Floating-point arithmetic concept
- Machine epsilon concept
- Round-off error concept
- Kahan summation algorithm statement
Further reading
About this page
| Tag | 4JAEKN22Y5 |
|---|---|
| URI | m2://4JAEKN22Y5 |
| Kind | statement, theorem |
| Writing | W0 stub |
| MSC | 65G50, 65B10 |
| Status | This copy of the site has no build data. Run m2 status 4JAEKN22Y5. |
| About | Round-off error |
| Uses | Floating-point arithmetic, Machine epsilon, Round-off error, Backward error analysis |
| Same as |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- an inventory row: the row of the inventory that the node accounts for (0 of 1)
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.