summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-10-06 16:25:03 +0200
committerEike Rathke <erack@redhat.com>2016-10-06 16:39:23 +0000
commitaf58bbf076069dc3dd467e9b9f0c34b937c2c09c (patch)
tree2fe275445d2da89c76ffffbb90c503f50d07ddc0 /sc/source
parente0d373bf5328bfe84079f094dd605bb8f4337330 (diff)
rtl::math::approxEqual(value,0.0) never yields true for value!=0.0
... so replace with a simple value == 0.0 Change-Id: I66bb05517467ff6f5e08852024ef6e067e6d6883 Reviewed-on: https://gerrit.libreoffice.org/29570 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/conditio.cxx4
-rw-r--r--sc/source/core/tool/interpr2.cxx8
2 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c5d712cac926..0f8764b29b12 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1120,7 +1120,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const
}
break;
case SC_COND_DIRECT:
- bValid = !::rtl::math::approxEqual( nComp1, 0.0 );
+ bValid = nComp1 != 0.0;
break;
case SC_COND_TOP10:
bValid = IsTopNElement( nArg );
@@ -1203,7 +1203,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos )
bool bValid = false;
// Interpret must already have been called
if ( eOp == SC_COND_DIRECT ) // Formula is independent from the content
- return !::rtl::math::approxEqual( nVal1, 0.0 );
+ return nVal1 != 0.0;
if ( eOp == SC_COND_DUPLICATE || eOp == SC_COND_NOTDUPLICATE )
{
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 826796f80b4a..086a8ccfe210 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2004,7 +2004,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
double fPowN, fPowNminus1; // for (1.0+fX)^Nper and (1.0+fX)^(Nper-1)
fPowNminus1 = pow( 1.0+fX, fNper-1.0);
fPowN = fPowNminus1 * (1.0+fX);
- if (rtl::math::approxEqual( fabs(fX), 0.0))
+ if (fX == 0.0)
{
fGeoSeries = fNper;
fGeoSeriesDerivation = fNper * (fNper-1.0)/2.0;
@@ -2020,7 +2020,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
bFound = true; // will catch root which is at an extreme
else
{
- if (rtl::math::approxEqual( fabs(fTermDerivation), 0.0))
+ if (fTermDerivation == 0.0)
fXnew = fX + 1.1 * SCdEpsilon; // move away from zero slope
else
fXnew = fX - fTerm / fTermDerivation;
@@ -2043,7 +2043,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
fX = (fGuess < -1.0) ? -1.0 : fGuess; // start with a valid fX
while (bValid && !bFound && nCount < nIterationsMax)
{
- if (rtl::math::approxEqual( fabs(fX), 0.0))
+ if (fX == 0.0)
{
fGeoSeries = fNper;
fGeoSeriesDerivation = fNper * (fNper-1.0)/2.0;
@@ -2059,7 +2059,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
bFound = true; // will catch root which is at an extreme
else
{
- if (rtl::math::approxEqual( fabs(fTermDerivation), 0.0))
+ if (fTermDerivation == 0.0)
fXnew = fX + 1.1 * SCdEpsilon; // move away from zero slope
else
fXnew = fX - fTerm / fTermDerivation;