diff options
author | Eike Rathke <erack@redhat.com> | 2017-09-04 12:57:16 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-09-29 16:42:48 +0200 |
commit | 149f28e9a5d66db18ffb36547b2ba394c303fc4d (patch) | |
tree | e1799cc5f7e6b20abd834c1cf7fd6ac057d78aa2 | |
parent | f38e9f1d194e23e455c69e9417185986daeccc39 (diff) |
Resolves: tdf#103734 propagate error from matrix to MIN()/MAX()
(cherry picked from commit 9e694c747954078442d47d3d7bd1d4db283b96ff)
Conflicts:
sc/source/core/tool/interpr1.cxx
Backported.
Change-Id: I1ebc5baf4957ef9e3d1477b803cf7fee02754360
Reviewed-on: https://gerrit.libreoffice.org/41886
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 22ae9153e5c9..16a902e21171 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3510,7 +3510,9 @@ void ScInterpreter::ScMin( bool bTextAsZero ) SetError(FormulaError::IllegalParameter); } } - if ( nVal < nMin ) + if (!rtl::math::isFinite(nVal)) + PushError( GetDoubleErrorValue( nVal)); + else if ( nVal < nMin ) PushDouble(0.0); else PushDouble(nMin); @@ -3605,7 +3607,9 @@ void ScInterpreter::ScMax( bool bTextAsZero ) SetError(FormulaError::IllegalParameter); } } - if ( nVal > nMax ) + if (!rtl::math::isFinite(nVal)) + PushError( GetDoubleErrorValue( nVal)); + else if ( nVal > nMax ) PushDouble(0.0); else PushDouble(nMax); diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 30fb6eb0b36f..ae64e61234af 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -1385,6 +1385,10 @@ struct MaxOp static double init() { return -std::numeric_limits<double>::max(); } static double compare(double left, double right) { + if (!rtl::math::isFinite(left)) + return left; + if (!rtl::math::isFinite(right)) + return right; return std::max(left, right); } @@ -1403,6 +1407,10 @@ struct MinOp static double init() { return std::numeric_limits<double>::max(); } static double compare(double left, double right) { + if (!rtl::math::isFinite(left)) + return left; + if (!rtl::math::isFinite(right)) + return right; return std::min(left, right); } |