llvm-project
3f594741 - [flang] Fix implementation of Kahan summation (#116897)

Commit
351 days ago
[flang] Fix implementation of Kahan summation (#116897) In the runtime's implementation of floating-point SUM, the implementation of Kahan's algorithm for increased precision is incorrect. The running correction factor should be subtracted from each new data item, not added to it. This fix ensures that the sum of 100M random default real values between 0. and 1. is close to 5.E7. See https://en.wikipedia.org/wiki/Kahan_summation_algorithm.
Author
Parents
Loading