lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] valyuta/002 95f34c4 06/21: Get rid of unneeded scala


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 95f34c4 06/21: Get rid of unneeded scalar doubleize()
Date: Fri, 18 Sep 2020 21:53:47 -0400 (EDT)

branch: valyuta/002
commit 95f34c43ebb70b0ba18ca770569bbaafa9f3fa1c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Get rid of unneeded scalar doubleize()
    
    Member function currency::d() does the same thing.
    
    In 'accountvalue.cpp', "currency(doubleize(..." had become unnecessary
    when operator*(int) was added.
---
 accountvalue.cpp |  2 +-
 currency.hpp     | 20 --------------------
 ihs_acctval.cpp  |  4 ++--
 ihs_avmly.cpp    | 10 +++++-----
 4 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/accountvalue.cpp b/accountvalue.cpp
index 5749a46..31ae361 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -823,7 +823,7 @@ void AccountValue::TxDoMlyDed()
 {
     AVUnloaned -=             CoiCharge + AdbCharge + WpCharge;
     MlyDed = YearsMonthlyPolicyFee + CoiCharge + AdbCharge + WpCharge;
-    mlydedtonextmodalpmtdate = currency(doubleize(MlyDed) * 
MonthsToNextModalPmtDate());
+    mlydedtonextmodalpmtdate = MlyDed * MonthsToNextModalPmtDate();
 }
 
 /// Credit interest on account value.
diff --git a/currency.hpp b/currency.hpp
index 11738f5..dc4604c 100644
--- a/currency.hpp
+++ b/currency.hpp
@@ -236,26 +236,6 @@ inline std::ostream& operator<<(std::ostream& os, currency 
const& c)
     return os << c.to_double();
 }
 
-#if 0
-// Sloppy.
-inline currency requantize(double z) {return currency(z);}
-
-inline std::vector<currency> currencyize(std::vector<double> const& z)
-{
-    std::vector<currency> r;
-    r.reserve(z.size());
-    for(auto const& i : z)
-        r.push_back(currency(i));
-    return r;
-}
-#endif // 0
-
-inline double doubleize(currency const& z)
-{
-//  return currency(z); // This implementation would seem surprising.
-    return z.d();
-}
-
 inline std::vector<double> doubleize(std::vector<currency> const& z)
 {
     std::vector<double> r;
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index a9a1de5..7316828 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -1115,8 +1115,8 @@ void AccountValue::SetProjectedCoiCharge()
     TxSetTermAmt();
     // presumably material_difference() isn't needed at all? um...yes, it is
     double this_years_terminal_naar = material_difference
-        (doubleize(DBReflectingCorr + TermDB)
-        ,doubleize(TotalAccountValue())
+        ((DBReflectingCorr + TermDB).d()
+        ,(TotalAccountValue()).d()
         );
     this_years_terminal_naar = std::max(0.0, this_years_terminal_naar);
     double next_years_coi_rate = GetBandedCoiRates(GenBasis_, ActualSpecAmt)[1 
+ Year];
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index f0860b7..a56705b 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -203,14 +203,14 @@ void AccountValue::DoMonthDR()
         }
     double necessary_premium = std::min // round?
         (material_difference // round?
-            (doubleize(GrossPmts[Month])
-            ,doubleize(gross_1035)
+            (GrossPmts[Month].d()
+            ,gross_1035.d()
             )
         ,max_necessary_premium
         );
     double unnecessary_premium = material_difference // round?
-        (doubleize(GrossPmts[Month])
-        ,doubleize(gross_1035) + necessary_premium
+        (GrossPmts[Month].d()
+        ,gross_1035.d() + necessary_premium
         );
 //  NetMaxNecessaryPremium
 //  GrossMaxNecessaryPremium
@@ -1834,7 +1834,7 @@ void AccountValue::TxSetCoiCharge()
     // the account value by deducting a negative mortality charge.
     NAAR = material_difference
         (DBReflectingCorr * DBDiscountRate[Year]
-        ,std::max(0.0, doubleize(TotalAccountValue()))
+        ,std::max(0.0, TotalAccountValue().d())
         );
     NAAR = std::max(0.0, round_naar()(NAAR));
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]