summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2014-09-13 20:44:58 +0200
committerThomas Arnhold <thomas@arnhold.org>2014-09-15 07:56:39 +0000
commita3ad01dc1e07da21182077bd899094fd73f57714 (patch)
tree30f765dfb8e6e12d35cba8f62b0798744f4cd5e6 /sc
parent5c2d2d087f22b00a8447d1d97de353242e89deab (diff)
cppcheck: unpreciseMathCall
Change-Id: I440dc3e30ee139d6cb261e1308e48e9b63b52bc8 Reviewed-on: https://gerrit.libreoffice.org/11434 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr2.cxx7
-rw-r--r--sc/source/core/tool/interpr3.cxx5
2 files changed, 7 insertions, 5 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 1326c5fed5e8..f5179a89426e 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -27,6 +27,7 @@
#include <svl/zforlist.hxx>
#include <svl/sharedstringpool.hxx>
#include <sal/macros.h>
+#include <boost/math/special_functions/log1p.hpp>
#include "attrib.hxx"
#include "sc.hrc"
@@ -1429,7 +1430,7 @@ void ScInterpreter::ScLaufz()
double nFuture = GetDouble();
double nPresent = GetDouble();
double nInterest = GetDouble();
- PushDouble(log(nFuture / nPresent) / log(1.0 + nInterest));
+ PushDouble(log(nFuture / nPresent) / boost::math::log1p(nInterest));
}
}
@@ -1543,9 +1544,9 @@ void ScInterpreter::ScZZR()
PushDouble(-(nBw + nZw)/nRmz);
else if (nFlag > 0.0)
PushDouble(log(-(nInterest*nZw-nRmz*(1.0+nInterest))/(nInterest*nBw+nRmz*(1.0+nInterest)))
- /log(1.0+nInterest));
+ /boost::math::log1p(nInterest));
else
- PushDouble(log(-(nInterest*nZw-nRmz)/(nInterest*nBw+nRmz))/log(1.0+nInterest));
+ PushDouble(log(-(nInterest*nZw-nRmz)/(nInterest*nBw+nRmz))/boost::math::log1p(nInterest));
}
bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 0a3ac920992f..41cb0c0df8da 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -33,6 +33,7 @@
#include <math.h>
#include <vector>
#include <algorithm>
+#include <boost/math/special_functions/log1p.hpp>
using ::std::vector;
using namespace formula;
@@ -587,7 +588,7 @@ double ScInterpreter::GetGamma(double fZ)
if (fZ >= -0.5) // shift to x>=1, might overflow
{
- double fLogTest = lcl_GetLogGammaHelper(fZ+2) - log(fZ+1) - log( fabs(fZ));
+ double fLogTest = lcl_GetLogGammaHelper(fZ+2) - boost::math::log1p(fZ) - log( fabs(fZ));
if (fLogTest >= fLogDblMax)
{
SetError( errIllegalFPOperation);
@@ -620,7 +621,7 @@ double ScInterpreter::GetLogGamma(double fZ)
return log(lcl_GetGammaHelper(fZ));
if (fZ >= 0.5)
return log( lcl_GetGammaHelper(fZ+1) / fZ);
- return lcl_GetLogGammaHelper(fZ+2) - log(fZ+1) - log(fZ);
+ return lcl_GetLogGammaHelper(fZ+2) - boost::math::log1p(fZ) - log(fZ);
}
double ScInterpreter::GetFDist(double x, double fF1, double fF2)