I am interested in "war stories" like this one:
I wrote a program involving the sum of floating point numbers but I did not use the Kahan summation.
The sum was
bad_sum
and the program gave me a wrong result.A colleague of mine, more versed than me in numerical analysis, had a look at the code and suggested me to use the Kahan summation, the sum is now
good_sum
and the program gives me the correct result.
I am interested in real-life production-code, not in code samples "artificially" created in order to explain the Kahan summation algorithm.
In particular what was the relative error (bad_sum-good_sum)/good_sum
for your application?
Up to now I have no similar story to tell. Maybe I will make some tests (running my program on an input data set, logging the program results and the sums with and without Kahan, estimate the relative error).