[all-commits] [llvm/llvm-project] 3f5947: [flang] Fix implementation of Kahan summation (#11...

Peter Klausler via All-commits all-commits at lists.llvm.org
Thu Nov 21 10:47:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f594741cf8e1537fb25f84ef3cf2245b08d8089
      https://github.com/llvm/llvm-project/commit/3f594741cf8e1537fb25f84ef3cf2245b08d8089
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2024-11-21 (Thu, 21 Nov 2024)

  Changed paths:
    M flang/lib/Evaluate/fold-matmul.h
    M flang/lib/Evaluate/fold-real.cpp
    M flang/lib/Evaluate/fold-reduction.h
    M flang/runtime/sum.cpp

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list