lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 0ae54b4 2/9: Refactor for terseness


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0ae54b4 2/9: Refactor for terseness
Date: Sat, 17 Feb 2018 11:13:04 -0500 (EST)

branch: master
commit 0ae54b4f1d7e359f7596c94884f0f97ce3d06534
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Refactor for terseness
---
 ledger_invariant.cpp | 81 +++++++---------------------------------------------
 1 file changed, 11 insertions(+), 70 deletions(-)

diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 3d64cb5..d4b7787 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -1269,45 +1269,17 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
 {
     irr_initialized_ = false;
 
-    int max_length = LedgerValues.GetMaxLength();
+    // Terse aliases for invariants.
+    int const m = LedgerValues.GetMaxLength();
+    int const n = irr_precision_;
 
     LedgerVariant const& Curr_ = LedgerValues.GetCurrFull();
     LedgerVariant const& Guar_ = LedgerValues.GetGuarFull();
-    irr
-        (Outlay
-        ,Guar_.CSVNet
-        ,IrrCsvGuarInput
-        ,Guar_.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
-
-    irr
-        (Outlay
-        ,Guar_.EOYDeathBft
-        ,IrrDbGuarInput
-        ,Guar_.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
 
-    irr
-        (Outlay
-        ,Curr_.CSVNet
-        ,IrrCsvCurrInput
-        ,Curr_.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
-
-    irr
-        (Outlay
-        ,Curr_.EOYDeathBft
-        ,IrrDbCurrInput
-        ,Curr_.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
+    irr(Outlay, Guar_.CSVNet,      IrrCsvGuarInput, Guar_.LapseYear, m, n);
+    irr(Outlay, Guar_.EOYDeathBft, IrrDbGuarInput,  Guar_.LapseYear, m, n);
+    irr(Outlay, Curr_.CSVNet,      IrrCsvCurrInput, Curr_.LapseYear, m, n);
+    irr(Outlay, Curr_.EOYDeathBft, IrrDbCurrInput,  Curr_.LapseYear, m, n);
 
     // Calculate these IRRs only for ledger types that actually use a
     // basis with a zero percent separate-account rate. This is a
@@ -1333,41 +1305,10 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
     LedgerVariant const& Curr0 = LedgerValues.GetCurrZero();
     LedgerVariant const& Guar0 = LedgerValues.GetGuarZero();
 
-    irr
-        (Outlay
-        ,Guar0.CSVNet
-        ,IrrCsvGuar0
-        ,Guar0.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
-
-    irr
-        (Outlay
-        ,Guar0.EOYDeathBft
-        ,IrrDbGuar0
-        ,Guar0.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
-
-    irr
-        (Outlay
-        ,Curr0.CSVNet
-        ,IrrCsvCurr0
-        ,Curr0.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
-
-    irr
-        (Outlay
-        ,Curr0.EOYDeathBft
-        ,IrrDbCurr0
-        ,Curr0.LapseYear
-        ,max_length
-        ,irr_precision_
-        );
+    irr(Outlay, Guar0.CSVNet,      IrrCsvGuar0, Guar0.LapseYear, m, n);
+    irr(Outlay, Guar0.EOYDeathBft, IrrDbGuar0,  Guar0.LapseYear, m, n);
+    irr(Outlay, Curr0.CSVNet,      IrrCsvCurr0, Curr0.LapseYear, m, n);
+    irr(Outlay, Curr0.EOYDeathBft, IrrDbCurr0,  Curr0.LapseYear, m, n);
 
     irr_initialized_ = true;
 }



reply via email to

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