[Libreoffice-commits] core.git: 2 commits - sc/source

Thomas Arnhold thomas at arnhold.org
Sat Aug 30 02:14:28 PDT 2014


 sc/source/core/inc/interpre.hxx  |    2 -
 sc/source/core/tool/interpr2.cxx |   46 +++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit e96d2593138d9e8eb197e21fa3087b45eae676c0
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sat Aug 30 11:04:40 2014 +0200

    interpr: ZinsesZins is Compound Interest
    
    There are many more, like ScZinsZ, ScLaufz, ScGetZw,...
    
    And some I can't identify, because my financial vocabulary is limited:
    
    nZr Zinsrate
    nZzr Zinseszinsrate
    nBw ?
    nZw Zinswert
    nRmz ?
    
    and many many more ;)
    
    Change-Id: I11c26a8d4519bbd1e8242d27d3815db2bc3fdecd

diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index eb24eb9..dc7de33 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -682,7 +682,7 @@ void ScZZR();
 bool RateIteration(double fNper, double fPayment, double fPv,
                                 double fFv, double fPayType, double& fGuess);
 void ScZins();
-double ScGetZinsZ(double fZins, double fZr, double fZzr, double fBw,
+double ScGetCompoundInterest(double fZins, double fZr, double fZzr, double fBw,
                          double fZw, double fF, double& fRmz);
 void ScZinsZ();
 void ScKapz();
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 512e756..1326c5f 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1708,27 +1708,27 @@ void ScInterpreter::ScZins()
     PushDouble(fGuess);
 }
 
-double ScInterpreter::ScGetZinsZ(double fInterest, double fZr, double fZzr, double fBw,
+double ScInterpreter::ScGetCompoundInterest(double fInterest, double fZr, double fZzr, double fBw,
                                  double fZw, double fF, double& fRmz)
 {
     fRmz = ScGetRmz(fInterest, fZzr, fBw, fZw, fF);     // fuer kapz auch bei fZr == 1
-    double fInterestZ;
+    double fCompoundInterest;
     nFuncFmtType = NUMBERFORMAT_CURRENCY;
     if (fZr == 1.0)
     {
         if (fF > 0.0)
-            fInterestZ = 0.0;
+            fCompoundInterest = 0.0;
         else
-            fInterestZ = -fBw;
+            fCompoundInterest = -fBw;
     }
     else
     {
         if (fF > 0.0)
-            fInterestZ = ScGetZw(fInterest, fZr-2.0, fRmz, fBw, 1.0) - fRmz;
+            fCompoundInterest = ScGetZw(fInterest, fZr-2.0, fRmz, fBw, 1.0) - fRmz;
         else
-            fInterestZ = ScGetZw(fInterest, fZr-1.0, fRmz, fBw, 0.0);
+            fCompoundInterest = ScGetZw(fInterest, fZr-1.0, fRmz, fBw, 0.0);
     }
-    return fInterestZ * fInterest;
+    return fCompoundInterest * fInterest;
 }
 
 void ScInterpreter::ScZinsZ()
@@ -1751,7 +1751,7 @@ void ScInterpreter::ScZinsZ()
     else
     {
         double nRmz;
-        PushDouble(ScGetZinsZ(nInterest, nZr, nZzr, nBw, nZw, nFlag, nRmz));
+        PushDouble(ScGetCompoundInterest(nInterest, nZr, nZzr, nBw, nZw, nFlag, nRmz));
     }
 }
 
@@ -1775,7 +1775,7 @@ void ScInterpreter::ScKapz()
     else
     {
         double nRmz;
-        double nInterestz = ScGetZinsZ(nInterest, nZr, nZzr, nBw, nZw, nFlag, nRmz);
+        double nInterestz = ScGetCompoundInterest(nInterest, nZr, nZzr, nBw, nZw, nFlag, nRmz);
         PushDouble(nRmz - nInterestz);
     }
 }
@@ -1800,22 +1800,22 @@ void ScInterpreter::ScKumZinsZ()
             sal_uLong nStart = (sal_uLong) fStart;
             sal_uLong nEnd = (sal_uLong) fEnd ;
             double fRmz = ScGetRmz(fInterest, fZzr, fBw, 0.0, fF);
-            double fInterestZ = 0.0;
+            double fCompoundInterest = 0.0;
             if (nStart == 1)
             {
                 if (fF <= 0.0)
-                    fInterestZ = -fBw;
+                    fCompoundInterest = -fBw;
                 nStart++;
             }
             for (sal_uLong i = nStart; i <= nEnd; i++)
             {
                 if (fF > 0.0)
-                    fInterestZ += ScGetZw(fInterest, (double)(i-2), fRmz, fBw, 1.0) - fRmz;
+                    fCompoundInterest += ScGetZw(fInterest, (double)(i-2), fRmz, fBw, 1.0) - fRmz;
                 else
-                    fInterestZ += ScGetZw(fInterest, (double)(i-1), fRmz, fBw, 0.0);
+                    fCompoundInterest += ScGetZw(fInterest, (double)(i-1), fRmz, fBw, 0.0);
             }
-            fInterestZ *= fInterest;
-            PushDouble(fInterestZ);
+            fCompoundInterest *= fInterest;
+            PushDouble(fCompoundInterest);
         }
     }
 }
commit dcda429221ea2a7094835eee792f749a6ae79bc4
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Sat Aug 30 10:57:40 2014 +0200

    interpr: fPeriodn -> fPeriods
    
    Change-Id: I21b76d2d121b27c5b4aeb676948786ab91bff0b7

diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 0657007..512e756 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1866,14 +1866,14 @@ void ScInterpreter::ScEffektiv()
     nFuncFmtType = NUMBERFORMAT_PERCENT;
     if ( MustHaveParamCount( GetByte(), 2 ) )
     {
-        double fPeriodn = GetDouble();
+        double fPeriods = GetDouble();
         double fNominal = GetDouble();
-        if (fPeriodn < 1.0 || fNominal <= 0.0)
+        if (fPeriods < 1.0 || fNominal <= 0.0)
             PushIllegalArgument();
         else
         {
-            fPeriodn = ::rtl::math::approxFloor(fPeriodn);
-            PushDouble(pow(1.0 + fNominal/fPeriodn, fPeriodn) - 1.0);
+            fPeriods = ::rtl::math::approxFloor(fPeriods);
+            PushDouble(pow(1.0 + fNominal/fPeriods, fPeriods) - 1.0);
         }
     }
 }
@@ -1883,14 +1883,14 @@ void ScInterpreter::ScNominal()
     nFuncFmtType = NUMBERFORMAT_PERCENT;
     if ( MustHaveParamCount( GetByte(), 2 ) )
     {
-        double fPeriodn = GetDouble();
+        double fPeriods = GetDouble();
         double fEffective = GetDouble();
-        if (fPeriodn < 1.0 || fEffective <= 0.0)
+        if (fPeriods < 1.0 || fEffective <= 0.0)
             PushIllegalArgument();
         else
         {
-            fPeriodn = ::rtl::math::approxFloor(fPeriodn);
-            PushDouble( (pow(fEffective + 1.0, 1.0 / fPeriodn) - 1.0) * fPeriodn );
+            fPeriods = ::rtl::math::approxFloor(fPeriods);
+            PushDouble( (pow(fEffective + 1.0, 1.0 / fPeriods) - 1.0) * fPeriods );
         }
     }
 }


More information about the Libreoffice-commits mailing list