From 20d3a60b41bda2513723c145d919f584840b1056 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 16 May 2017 23:50:46 +0200 Subject: tdf#107892: fix negative values case with maxifs std::numeric_limits::min() returns positive value for float/double so use std::numeric_limits::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 Reviewed-by: Eike Rathke --- sc/source/core/inc/interpre.hxx | 2 +- sc/source/core/tool/interpr1.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 6390f4402af6..902fde9e1376 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::max(); - double mfMax = std::numeric_limits::min(); + double mfMax = std::numeric_limits::lowest(); }; } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fb1503e697d2..36e5107a814f 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5773,7 +5773,7 @@ void ScInterpreter::ScMaxIfs_MS() sc::ParamIfsResult aRes; IterateParametersIfs(aRes); - PushDouble((aRes.mfMax > std::numeric_limits::min()) ? aRes.mfMax : 0.0); + PushDouble((aRes.mfMax > std::numeric_limits::lowest()) ? aRes.mfMax : 0.0); } void ScInterpreter::ScLookup() -- cgit