lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/002 346c95b 05/65: improve


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/002 346c95b 05/65: improve
Date: Wed, 16 Sep 2020 16:55:11 -0400 (EDT)

branch: valyuta/002
commit 346c95b518e8ae27dc3601d07c1c840642388eaa
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    improve
---
 ihs_avstrtgy.cpp |  2 +-
 ihs_basicval.cpp | 53 ++++++++++++++++++++++++++++++-----------------------
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/ihs_avstrtgy.cpp b/ihs_avstrtgy.cpp
index 10cc3c0..27f2aa9 100644
--- a/ihs_avstrtgy.cpp
+++ b/ihs_avstrtgy.cpp
@@ -178,7 +178,7 @@ void AccountValue::PerformSupplAmtStrategy()
         currency explicit_value = DeathBfts_->supplamt()[j];
         mcenum_sa_strategy strategy = 
yare_input_.SupplementalAmountStrategy[j];
         currency z = CalculateSpecAmtFromStrategy(j, 0, explicit_value, 
strategy);
-        DeathBfts_->set_supplamt(currency(round_specamt()(std::max(m, z))), j, 
1 + j);
+        DeathBfts_->set_supplamt(currency(round_specamt()(std::max(m, z))), j, 
1 + j); // rounding
         }
 }
 
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 9c5e518..70bdbf6 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -972,7 +972,8 @@ currency BasicValues::GetModalPremMaxNonMec
 {
     // TAXATION !! No table available if 7PP calculated from first principles.
     double temp = MortalityRates_->SevenPayRates()[0];
-    return currency(round_max_premium()(ldbl_eps_plus_one_times(temp * 
a_specamt / a_mode)));
+    double z = round_max_premium()(ldbl_eps_plus_one_times(temp * a_specamt / 
a_mode));
+    return currency(z);
 }
 
 /// Calculate premium using a minimum-premium ratio.
@@ -988,15 +989,14 @@ currency BasicValues::GetModalPremMinFromTable
     ,currency    a_specamt
     ) const
 {
-    return currency(
-            round_max_premium()
-            (ldbl_eps_plus_one_times
-                (
-                    a_specamt * MortalityRates_->MinimumPremiumRates()[0]
-                /   a_mode
-                )
+    double z = round_max_premium()
+        (ldbl_eps_plus_one_times
+            (
+                a_specamt * MortalityRates_->MinimumPremiumRates()[0]
+            /   a_mode
             )
         );
+    return currency(z);
 }
 
 /// Calculate premium using a target-premium ratio.
@@ -1028,7 +1028,7 @@ currency BasicValues::GetModalPremTgtFromTable
     ,currency    a_specamt
     ) const
 {
-    return currency(round_max_premium()
+    double z = round_max_premium()
         (ldbl_eps_plus_one_times
             (
                 ( TgtPremMonthlyPolFee * 12.0
@@ -1036,7 +1036,8 @@ currency BasicValues::GetModalPremTgtFromTable
                 )
             /   a_mode
             )
-        ));
+        );
+    return currency(z);
 }
 
 /// Calculate premium using a tabular proxy for group insurance.
@@ -1048,13 +1049,14 @@ currency BasicValues::GetModalPremProxyTable
     ,double      a_table_multiplier
     ) const
 {
-    return currency(round_gross_premium()
+    double z = round_gross_premium()
         (
           a_specamt
         * MortalityRates_->GroupProxyRates()[a_year]
         * a_table_multiplier
         / a_mode
-        ));
+        );
+    return currency(z);
 }
 
 /// Calculate premium using a corridor ratio.
@@ -1070,7 +1072,8 @@ currency BasicValues::GetModalPremCorridor
     ) const
 {
     double temp = GetCorridorFactor()[0];
-    return currency(round_max_premium()(ldbl_eps_plus_one_times((a_specamt / 
temp) / a_mode)));
+    double z = round_max_premium()(ldbl_eps_plus_one_times((a_specamt / temp) 
/ a_mode));
+    return currency(z);
 }
 
 //============================================================================
@@ -1470,11 +1473,13 @@ currency BasicValues::GetModalSpecAmtMax(currency 
annualized_pmt) const
         case oe_modal_nonmec:
             return GetModalSpecAmtMinNonMec(annualized_pmt);
         case oe_modal_table:
-            return currency(round_min_specamt()
-                (
-                    annualized_pmt
-                /   MortalityRates_->MinimumPremiumRates()[0]
-                ));
+            return currency
+                (round_min_specamt()
+                    (
+                        annualized_pmt
+                    /   MortalityRates_->MinimumPremiumRates()[0]
+                    )
+                );
         }
     throw "Unreachable--silences a compiler diagnostic.";
 }
@@ -1494,11 +1499,13 @@ currency BasicValues::GetModalSpecAmtTgt(currency 
annualized_pmt) const
         case oe_modal_nonmec:
             return GetModalSpecAmtMinNonMec(annualized_pmt);
         case oe_modal_table:
-            return currency(round_min_specamt()
-                (
-                    (annualized_pmt - TgtPremMonthlyPolFee * 12.0)
-                /   MortalityRates_->TargetPremiumRates()[0]
-                ));
+            return currency
+                (round_min_specamt()
+                    (
+                        (annualized_pmt - TgtPremMonthlyPolFee * 12.0)
+                    /   MortalityRates_->TargetPremiumRates()[0]
+                    )
+                );
         }
     throw "Unreachable--silences a compiler diagnostic.";
 }



reply via email to

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