[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Mon Sep 4 10:58:14 UTC 2017
sc/source/core/tool/interpr1.cxx | 8 ++++++--
sc/source/core/tool/scmatrix.cxx | 8 ++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 9e694c747954078442d47d3d7bd1d4db283b96ff
Author: Eike Rathke <erack at redhat.com>
Date: Mon Sep 4 12:57:16 2017 +0200
Resolves: tdf#103734 propagate error from matrix to MIN()/MAX()
Change-Id: I1ebc5baf4957ef9e3d1477b803cf7fee02754360
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 1b1ba4f703a6..78a7e6311b68 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3631,7 +3631,9 @@ void ScInterpreter::ScMin( bool bTextAsZero )
}
else
{
- if ( nVal < nMin )
+ if (!rtl::math::isFinite(nVal))
+ PushError( GetDoubleErrorValue( nVal));
+ else if ( nVal < nMin )
PushDouble(0.0); // zero or only empty arguments
else
PushDouble(nMin);
@@ -3786,7 +3788,9 @@ void ScInterpreter::ScMax( bool bTextAsZero )
}
else
{
- if ( nVal > nMax )
+ if (!rtl::math::isFinite(nVal))
+ PushError( GetDoubleErrorValue( nVal));
+ else if ( nVal > nMax )
PushDouble(0.0); // zero or only empty arguments
else
PushDouble(nMax);
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 6e0e9bb7b69b..27836073b491 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1390,6 +1390,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);
}
@@ -1408,6 +1412,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);
}
More information about the Libreoffice-commits
mailing list