[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sc/source
Eike Rathke
erack at redhat.com
Fri Sep 15 19:10:26 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 09b4b50ef5bfe1b7d963ae70071d4e8ce20f361d
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()
(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 at libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
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);
}
More information about the Libreoffice-commits
mailing list