Kahan summation algorithm
Algorithm in numerical analysis
Algorithm in numerical analysis
In numerical analysis, the Kahan summation algorithm, also known as compensated summation, significantly reduces the numerical error in the total obtained by adding a sequence of finite-precision floating-point numbers, compared to the naive approach (a summation algorithm). This is done by keeping a separate running compensation (a variable to accumulate small errors), in effect extending the precision of the sum by the precision of the compensation variable. In particular, simply summing n {\displaystyle n} numbers in sequence has a worst-case error that grows proportional to n {\displaystyle n} , and a root mean square error that grows as n {\displaystyle {\sqrt {n}}} for random inputs (the roundoff errors form a random walk). With compensated summation, using a compensation variable with sufficiently high precision...
Open boosters, collect cards and trade them. Free to play.
Play for free