[Libreoffice-commits] core.git: scaddins/source

Noel Grandin noel at peralex.com
Thu Feb 4 06:25:08 UTC 2016


 scaddins/source/analysis/analysishelper.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 318a23b4f4e3e02b664437044de833b9a8e4f85f
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jan 27 11:06:10 2016 +0200

    loplugin:fpcomparison in scaddins/
    
    Change-Id: I9a303a92f5531d549faf6d86ea0ce6360e115567
    Reviewed-on: https://gerrit.libreoffice.org/21865
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index b820606..b0af04e 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -1123,15 +1123,15 @@ double getYield_( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, double
     double      fPrice2 = getPrice_( nNullDate, nSettle, nMat, fRate, fYield2, fRedemp, nFreq, nBase );
     double      fYieldN = ( fYield2 - fYield1 ) * 0.5;
 
-    for( sal_uInt32 nIter = 0 ; nIter < 100 && fPriceN != fPrice ; nIter++ )
+    for( sal_uInt32 nIter = 0 ; nIter < 100 && !rtl::math::approxEqual(fPriceN, fPrice) ; nIter++ )
     {
         fPriceN = getPrice_( nNullDate, nSettle, nMat, fRate, fYieldN, fRedemp, nFreq, nBase );
 
-        if( fPrice == fPrice1 )
+        if( rtl::math::approxEqual(fPrice, fPrice1) )
             return fYield1;
-        else if( fPrice == fPrice2 )
+        else if( rtl::math::approxEqual(fPrice, fPrice2) )
             return fYield2;
-        else if( fPrice == fPriceN )
+        else if( rtl::math::approxEqual(fPrice, fPriceN) )
             return fYieldN;
         else if( fPrice < fPrice2 )
         {


More information about the Libreoffice-commits mailing list