lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master cc69611 4/5: Refactor to make deductions avai


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cc69611 4/5: Refactor to make deductions available separately
Date: Tue, 13 Jun 2017 12:03:02 -0400 (EDT)

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

    Refactor to make deductions available separately
    
    For list bills, raw deductions are wanted instead of annuitized and
    rounded premiums. Refactored accordingly.
---
 basic_values.hpp |  5 +++++
 ihs_basicval.cpp | 42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/basic_values.hpp b/basic_values.hpp
index 0583218..f3c24ef 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -34,6 +34,7 @@
 
 #include <memory>                       // std::shared_ptr
 #include <string>
+#include <utility>                      // std::pair
 #include <vector>
 
 // Let's do this through once for UL, then think about extending it to other
@@ -387,6 +388,10 @@ class LMI_SO BasicValues
         ,oenum_modal_prem_type a_prem_type
         ) const;
     double mly_ded_discount_factor(int year, mcenum_mode mode) const;
+    std::pair<double,double> approx_mly_ded
+        (int    year
+        ,double specamt
+        ) const;
     double GetModalPremMlyDed
         (int         year
         ,mcenum_mode mode
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 46f4783..0311fcf 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -1078,7 +1078,7 @@ double BasicValues::mly_ded_discount_factor(int year, 
mcenum_mode mode) const
     return 1.0 / u;
 }
 
-/// Determine an approximate "pay as you go" modal premium.
+/// Determine approximate monthly deductions.
 ///
 /// This more or less represents actual monthly deductions, at least
 /// for monthly mode on an option B contract, generally favoring
@@ -1102,11 +1102,22 @@ double BasicValues::mly_ded_discount_factor(int year, 
mcenum_mode mode) const
 /// If annual_policy_fee is not zero, then level premium on any mode
 /// other than annual cannot precisely cover monthly deductions due
 /// to the fee's uneven incidence.
-
-double BasicValues::GetModalPremMlyDed
-    (int         year
-    ,mcenum_mode mode
-    ,double      specamt
+///
+/// It might be objected that this function's name suggests that all
+/// deductions are monthly, whereas it returns "annual" and "monthly"
+/// deductions. Naming rationale: "monthly deduction" is a standard
+/// term with an unambiguous meaning; the "annual" policy fee is part
+/// of the monthly deduction on anniversary only.
+///
+/// This function and the modal-premium function implemented in terms
+/// of it are intended for use with group UL products for which the
+/// employer typically pays the approximate monthly deductions, but
+/// may also be used with any UL product when such a payment pattern
+/// is desired.
+
+std::pair<double,double> BasicValues::approx_mly_ded
+    (int    year
+    ,double specamt
     ) const
 {
     double mly_ded = specamt * DBDiscountRate[year];
@@ -1172,12 +1183,23 @@ double BasicValues::GetModalPremMlyDed
     mly_ded /= 1.0 - load;
     ann_ded /= 1.0 - load;
 
-    double const v12 = mly_ded_discount_factor(year, mode);
-    mly_ded *= (1.0 - std::pow(v12, 12.0 / mode)) / (1.0 - v12);
+    return std::make_pair(ann_ded, mly_ded);
+}
 
-    mly_ded += ann_ded;
+/// Determine an approximate "pay as you go" modal premium.
 
-    return round_min_premium()(mly_ded);
+double BasicValues::GetModalPremMlyDed
+    (int         year
+    ,mcenum_mode mode
+    ,double      specamt
+    ) const
+{
+    auto const deductions = approx_mly_ded(year, specamt);
+    double const ann_ded = deductions.first;
+    double const mly_ded = deductions.second;
+    double const v12 = mly_ded_discount_factor(year, mode);
+    double const annuity = (1.0 - std::pow(v12, 12.0 / mode)) / (1.0 - v12);
+    return round_min_premium()(ann_ded + mly_ded * annuity);
 }
 
 // The "-Ee" and "-Er" variants are written with preprocessor



reply via email to

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