[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;
}
- [lmi-commits] [lmi] master updated (422cd51 -> 5e372c6), Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 36d5a6b 1/9: Remove unnecessary static_cast, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 513e891 4/9: Improve documentation, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master ca32be5 3/9: Find a root of the zero polynomial, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 3781a93 5/9: Refactor for rearrangeability, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 0ae54b4 2/9: Refactor for terseness,
Greg Chicares <=
- [lmi-commits] [lmi] master b710396 8/9: Don't assume--assert, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 3f1dd88 7/9: Consolidate and improve documentation, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 060aecf 6/9: Rearrange for comprehensibility, Greg Chicares, 2018/02/17
- [lmi-commits] [lmi] master 5e372c6 9/9: Perform ledger IRR initialization in one place only, Greg Chicares, 2018/02/17