[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Fri Sep 25 04:51:37 PDT 2015


 sc/source/core/tool/interpr6.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c1780ad265ce5f6abb3b91a4f70bf2b3d7a47149
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Sep 25 13:42:04 2015 +0200

    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

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 69a11a0..c6ae7c9 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -400,7 +400,7 @@ void IterateMatrix(
         case ifPRODUCT:
         {
             ScMatrix::IterateResult aRes = pMat->Product(bTextAsZero);
-            fRes = aRes.mfFirst;
+            fRes *= aRes.mfFirst;
             fRes *= aRes.mfRest;
             rCount += aRes.mnCount;
         }
@@ -408,6 +408,7 @@ void IterateMatrix(
         case ifSUMSQ:
         {
             ScMatrix::IterateResult aRes = pMat->SumSquare(bTextAsZero);
+            fRes += aRes.mfFirst;
             fRes += aRes.mfRest;
             rCount += aRes.mnCount;
         }


More information about the Libreoffice-commits mailing list