[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source

Eike Rathke erack at redhat.com
Fri Sep 29 14:43:10 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 149f28e9a5d66db18ffb36547b2ba394c303fc4d
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/41886
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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);
     }
 


More information about the Libreoffice-commits mailing list