summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-09-25 13:42:04 +0200
committerŁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-09-25 13:18:15 +0000
commit6b8b3ffad1222fcd4431aa87396ea77f66522707 (patch)
tree57a830bf960964c6ec4fb4123b4ba0db1125f891 /sc
parenta9670e0735b77ecc40aa8af4106af7d32ec548a0 (diff)
fix IterateMatrix for ifPRODUCT and ifSUMSQ
... if more than one argument is passed to PRODUCT() or SUMSQ() and matrix/array arguments are involved the functions returned wrong results. For example, wrong behavior =PRODUCT({2,3},{4,5}) gave 6 =SUMSQ({2,3},{4,5}) gave 34 Correct is =PRODUCT({2,3},{4,5}) result 120 =SUMSQ({2,3},{4,5}) result 54 Change-Id: Iec7b136a5cc678416f28b1abfe19cd0901ef22b6 (cherry picked from commit c1780ad265ce5f6abb3b91a4f70bf2b3d7a47149) Reviewed-on: https://gerrit.libreoffice.org/18864 Reviewed-by: Łukasz Hryniuk <lukasz.hryniuk@wp.pl> Tested-by: Łukasz Hryniuk <lukasz.hryniuk@wp.pl>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr6.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index b3daedd17b7d..e02abbc96ba2 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -384,7 +384,7 @@ void IterateMatrix(
case ifPRODUCT:
{
ScMatrix::IterateResult aRes = pMat->Product(bTextAsZero);
- fRes = aRes.mfFirst;
+ fRes *= aRes.mfFirst;
fRes *= aRes.mfRest;
rCount += aRes.mnCount;
}
@@ -392,6 +392,7 @@ void IterateMatrix(
case ifSUMSQ:
{
ScMatrix::IterateResult aRes = pMat->SumSquare(bTextAsZero);
+ fRes += aRes.mfFirst;
fRes += aRes.mfRest;
rCount += aRes.mnCount;
}