diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-24 12:26:01 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-24 12:51:59 -0400 |
commit | 4158d8843d50d50e9830c8dc24af8722de77f4af (patch) | |
tree | 34740ecaad0095d2bce76acd381855da87781bdf | |
parent | d36442aa31a57b8c559f33564dde5366358564f1 (diff) |
fdo#76663: Let's not skip the first element of a matrix in PRODUCT.
Change-Id: I00683ce64fea58a80cd7137384e8f30464c44e9f
-rw-r--r-- | sc/source/core/tool/interpr6.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 14 |
2 files changed, 11 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index 97282d0814c1..84d459999136 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -387,6 +387,7 @@ void IterateMatrix( case ifPRODUCT: { ScMatrix::IterateResult aRes = pMat->Product(bTextAsZero); + fRes = aRes.mfFirst; fRes *= aRes.mfRest; rCount += aRes.mnCount; } diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index e926e4bd7264..b71da72b9f2d 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -950,7 +950,7 @@ namespace { struct SumOp { - static const int InitVal = 0; + static const double InitVal; void operator() (double& rAccum, double fVal) { @@ -958,9 +958,11 @@ struct SumOp } }; +const double SumOp::InitVal = 0.0; + struct SumSquareOp { - static const int InitVal = 0; + static const double InitVal; void operator() (double& rAccum, double fVal) { @@ -968,9 +970,11 @@ struct SumSquareOp } }; +const double SumSquareOp::InitVal = 0.0; + struct ProductOp { - static const int InitVal = 1; + static const double InitVal; void operator() (double& rAccum, double fVal) { @@ -978,6 +982,8 @@ struct ProductOp } }; +const double ProductOp::InitVal = 1.0; + template<typename _Op> class WalkElementBlocks : std::unary_function<MatrixImplType::element_block_node_type, void> { @@ -987,7 +993,7 @@ class WalkElementBlocks : std::unary_function<MatrixImplType::element_block_node bool mbFirst:1; bool mbTextAsZero:1; public: - WalkElementBlocks(bool bTextAsZero) : maRes(0.0, _Op::InitVal, 0), mbFirst(true), mbTextAsZero(bTextAsZero) {} + WalkElementBlocks(bool bTextAsZero) : maRes(_Op::InitVal, _Op::InitVal, 0), mbFirst(true), mbTextAsZero(bTextAsZero) {} const ScMatrix::IterateResult& getResult() const { return maRes; } |