diff options
author | dante <dante19031999@gmail.com> | 2021-04-25 12:20:58 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-28 16:31:45 +0200 |
commit | fd4df675dfe1012448285134082f61a0c03a7d15 (patch) | |
tree | a8833550db046a6c69bf19a72ddad861e53a9fc9 /sc/inc/matrixoperators.hxx | |
parent | bc7c37f2f67ace27196a46c62c2d568501e9f796 (diff) |
tdf#137679 Use Kahan summation for scmatrix operations
May also want implement Kahan sum in there:
sc/source/core/tool/arraysumSSE2.cxx
sc/source/core/inc/arraysumfunctor.hxx
Under some conditions the sum of a pointer type vector
may be perforemed by arraysumfunctor on NumericCellAccumulator.
arraysumSSE2 implements part of it.
This code has been left unmodified.
Why the test has been modified:
The error was: 238.89000000000001 != 238.89
|
17 th digit
IEEE 754 double-precision has 53 log10(2) ≈ 15.955 digits.
So it's just noise.
Change-Id: I6f84826bf3875be4f444f5eb61854bc1f95769bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114627
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/inc/matrixoperators.hxx')
-rw-r--r-- | sc/inc/matrixoperators.hxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/inc/matrixoperators.hxx b/sc/inc/matrixoperators.hxx index 540a38e93370..36fa1cabe3d6 100644 --- a/sc/inc/matrixoperators.hxx +++ b/sc/inc/matrixoperators.hxx @@ -11,6 +11,7 @@ #include <functional> +#include "math.hxx" namespace sc::op { @@ -35,19 +36,19 @@ using Op = Op_<std::function<void(double&, double)>>; struct Sum { static const double InitVal; - void operator()(double& rAccum, double fVal) const; + void operator()(KahanSum& rAccum, double fVal) const; }; struct SumSquare { static const double InitVal; - void operator()(double& rAccum, double fVal) const; + void operator()(KahanSum& rAccum, double fVal) const; }; struct Product { static const double InitVal; - void operator()(double& rAccum, double fVal) const; + void operator()(KahanSum& rAccum, double fVal) const; }; } |