lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master be841c05 3/9: Refactor for clarity


From: Greg Chicares
Subject: [lmi-commits] [lmi] master be841c05 3/9: Refactor for clarity
Date: Fri, 6 May 2022 19:37:36 -0400 (EDT)

branch: master
commit be841c05731512d42f6d64ea6fc98722b5b923b3
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Refactor for clarity
    
    The present goal is to make all expressions involving
    ldbl_eps_plus_one_times() as similar as possible.
    
    'TgtPremMonthlyPolFee' is already a currency amount--an integral number
    of cents--and (12/mode) is an integer, so their product is an integral
    number of cents, and can therefore be hoisted out of the expression
    that is be rounded.
---
 ihs_basicval.cpp | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 590f7c6d..5dff8be6 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -958,7 +958,7 @@ currency BasicValues::GetModalPremMinFromTable
 ///    be used instead.
 /// Therefore, in those other two cases, 'TgtPremMonthlyPolFee' is
 /// asserted to be zero--upstream, so that it'll signal an error even
-/// if a target strategy isn't used.
+/// if the target strategy isn't used.
 
 currency BasicValues::GetModalPremTgtFromTable
     (int      // a_year // Unused.
@@ -966,16 +966,9 @@ currency BasicValues::GetModalPremTgtFromTable
     ,currency    a_specamt
     ) const
 {
+    currency const modal_fee = TgtPremMonthlyPolFee * (12 / a_mode);
     double const rate = MortalityRates_->TargetPremiumRates()[0];
-    return round_max_premium().c
-        (ldbl_eps_plus_one_times
-            (
-                ( TgtPremMonthlyPolFee * 12.0
-                + (a_specamt * rate)
-                )
-            /   a_mode
-            )
-        );
+    return modal_fee + round_max_premium().c(ldbl_eps_plus_one_times(a_specamt 
* rate / a_mode));
 }
 
 /// Calculate premium using a tabular proxy for group insurance.



reply via email to

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