A summation algorithm that keeps a correction for low-order information lost when adding floating-point numbers. Feeding that correction into subsequent additions can greatly reduce accumulated rounding error compared with straightforward summation.
Articles by others on the same topic
The Kahan summation algorithm, also known as compensated summation, is a numerical technique used to improve the precision of the summation of a sequence of floating-point numbers. It mitigates the error that can occur when small numbers are added to large numbers, a common issue in floating-point arithmetic due to limited precision. ### How it Works The algorithm maintains an extra variable (often called `c`, for "compensation") that keeps track of small error terms.