[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Thu Oct 6 16:41:31 UTC 2016
sc/source/core/data/conditio.cxx | 4 ++--
sc/source/core/tool/interpr2.cxx | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
New commits:
commit af58bbf076069dc3dd467e9b9f0c34b937c2c09c
Author: Eike Rathke <erack at redhat.com>
Date: Thu Oct 6 16:25:03 2016 +0200
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 at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index c5d712c..0f8764b 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 826796f..086a8cc 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;
More information about the Libreoffice-commits
mailing list