summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-05-16 23:50:46 +0200
committerEike Rathke <erack@redhat.com>2017-05-17 21:45:49 +0200
commitf6d7bd1f525d3930c48b61abb2e91418f2c66ca5 (patch)
tree651c53989aed0577b53792b9e0c5566a73e8f55a
parentd881d77429371c3a04b758b151b091267c13d167 (diff)
tdf#107892: fix negative values case with maxifs
std::numeric_limits<double>::min() returns positive value for float/double so use std::numeric_limits<double>::lowest() (see http://stackoverflow.com/questions/17070351/why-does-numeric-limitsmin-return-a-negative-value-for-int-but-positive-values) Change-Id: I0afce2d38c6936aeff26923182bcafd2f0008d9e Reviewed-on: https://gerrit.libreoffice.org/37693 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 20d3a60b41bda2513723c145d919f584840b1056) Reviewed-on: https://gerrit.libreoffice.org/37730
-rw-r--r--sc/source/core/inc/interpre.hxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx2
2 files changed, 2 insertions, 2 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index fe860eba7120..636f2ecd62d1 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -69,7 +69,7 @@ struct ParamIfsResult
double mfMem = 0.0;
double mfCount = 0.0;
double mfMin = std::numeric_limits<double>::max();
- double mfMax = std::numeric_limits<double>::min();
+ double mfMax = std::numeric_limits<double>::lowest();
};
}
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9a02b624df22..f005b26e4635 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5780,7 +5780,7 @@ void ScInterpreter::ScMaxIfs_MS()
sc::ParamIfsResult aRes;
IterateParametersIfs(aRes);
- PushDouble((aRes.mfMax > std::numeric_limits<double>::min()) ? aRes.mfMax : 0.0);
+ PushDouble((aRes.mfMax > std::numeric_limits<double>::lowest()) ? aRes.mfMax : 0.0);
}
void ScInterpreter::ScLookup()