Accurate summation algorithm

You do know that both of these algorithms are already in the Julia standard library, right?

sum_kbn is Kahan summation, and sum uses pairwise summation for any sufficiently large array.

And there is a well known paper by Higham analyzing these and other summation variants (e.g. sorting before summing). (But the analysis depends on the order of the operations, which a “fast-math” compiler might alter, of course.)

1 Like