[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 774a4f1 1/3: Refactor
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 774a4f1 1/3: Refactor |
Date: |
Thu, 13 Aug 2020 14:11:17 -0400 (EDT) |
branch: master
commit 774a4f1a1f41bf444d3a2b29334fdeae9616f4f3
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Refactor
AccountValue::DoPerformPmtStrategy() already deferred to member
functions of class BasicValues for all other strategies (except for
mce_pmt_input_scalar, which is a simple passthrough). Made it do
likewise for the mce_pmt_table strategy.
Grouping all such code in the same place makes it more obvious that
the mce_pmt_table calculation, unlike the others, doesn't round.
---
basic_values.hpp | 6 ++++++
ihs_avstrtgy.cpp | 12 ++++++------
ihs_basicval.cpp | 17 +++++++++++++++++
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/basic_values.hpp b/basic_values.hpp
index c90110f..1afa805 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -218,6 +218,12 @@ class LMI_SO BasicValues
,mcenum_mode a_mode
,double a_specamt
) const;
+ double GetModalPremProxyTable
+ (int a_year
+ ,mcenum_mode a_mode
+ ,double a_specamt
+ ,double a_table_multiplier
+ ) const;
double GetModalPremCorridor
(int a_year
,mcenum_mode a_mode
diff --git a/ihs_avstrtgy.cpp b/ihs_avstrtgy.cpp
index b5a8788..d93f350 100644
--- a/ihs_avstrtgy.cpp
+++ b/ihs_avstrtgy.cpp
@@ -300,12 +300,12 @@ double AccountValue::DoPerformPmtStrategy
}
case mce_pmt_table:
{
- return
- ActualSpecAmt
- * MortalityRates_->GroupProxyRates()[Year]
- * a_TblMult
- / a_CurrentMode
- ;
+ return GetModalPremProxyTable
+ (Year
+ ,a_CurrentMode
+ ,ActualSpecAmt
+ ,a_TblMult
+ );
}
}
throw "Unreachable--silences a compiler diagnostic.";
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index e473018..2dea9a3 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -962,6 +962,23 @@ double BasicValues::GetModalPremTgtFromTable
);
}
+/// Calculate premium using a tabular proxy for group insurance.
+
+double BasicValues::GetModalPremProxyTable
+ (int a_year
+ ,mcenum_mode a_mode
+ ,double a_specamt
+ ,double a_table_multiplier
+ ) const
+{
+ return
+ a_specamt
+ * MortalityRates_->GroupProxyRates()[a_year]
+ * a_table_multiplier
+ / a_mode
+ ;
+}
+
/// Calculate premium using a corridor ratio.
///
/// Only the initial corridor factor is used here, because this