summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-04 12:57:16 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-09-15 21:10:03 +0200
commit09b4b50ef5bfe1b7d963ae70071d4e8ce20f361d (patch)
tree8cd81a88d3c51bd6edafadc651c2638dbaac408c
parent06530418dbb3ac41d671efed87d54434d19f0569 (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/41883 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sc/source/core/tool/interpr1.cxx8
-rw-r--r--sc/source/core/tool/scmatrix.cxx8
2 files changed, 14 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index c27e4c2ede86..42db756a2e01 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3509,7 +3509,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);
@@ -3604,7 +3606,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 0a3dca7cb12d..c4309474db68 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1388,6 +1388,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);
}
@@ -1406,6 +1410,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);
}