[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.
- [lmi-commits] [lmi] master updated (13799952 -> 9e5a09bf), Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master be841c05 3/9: Refactor for clarity,
Greg Chicares <=
- [lmi-commits] [lmi] master a24d665c 4/9: Include only appropriate headers, and say why they're included, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 46534540 2/9: Refactor for uniformity, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 9e5a09bf 9/9: Record speed measurements, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 78657d01 6/9: Improve physical structure, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 4b8bf312 1/9: Expunge workarounds for nonexistent problems, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 67af2e9b 5/9: Improve a debatable workaround, Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 205497ae 8/9: Reimplement max_modal_premium(), Greg Chicares, 2022/05/06
- [lmi-commits] [lmi] master 1de83b9d 7/9: Refactor, Greg Chicares, 2022/05/06