[flang] Use a "double-double" accumulator in SUM
authorpeter klausler <pklausler@nvidia.com>
Tue, 15 Jun 2021 22:19:18 +0000 (15:19 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 16 Jun 2021 21:29:39 +0000 (14:29 -0700)
commitc375ec86132984bc3915323fbe3f8c71f4d5503f
tree208d2e3c4941d47ade6a102491ecd4fb67fc8465
parent8b062b61606270950645d73b68036c9ab2c7c4bc
[flang] Use a "double-double" accumulator in SUM

Use a "double-double" accumulator, a/k/a Kahan summation,
in the SUM intrinsic in the runtime for real & complex.
This seems to be the best-recommended technique for reducing
error, as opposed to the initial implementation of SUM's
distinct accumulators for positive and negative items.

Differential Revision: https://reviews.llvm.org/D104338
flang/runtime/sum.cpp