lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9553083 4/7: Prepare to round in class modal_


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9553083 4/7: Prepare to round in class modal_outlay
Date: Sun, 23 Aug 2020 18:00:51 -0400 (EDT)

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

    Prepare to round in class modal_outlay
    
    An argument might be made for holding the function objects as const
    reference members, but the function objects are so small that the
    existence of any contrary argument is conclusive.
---
 basicvalues.cpp  |  2 +-
 ihs_basicval.cpp | 10 ++++++----
 outlay.cpp       | 12 ++++++++++--
 outlay.hpp       | 12 +++++++++++-
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/basicvalues.cpp b/basicvalues.cpp
index d93a0e0..6273d6f 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -114,7 +114,7 @@ void BasicValues::Init()
     MortalityRates_.reset(new MortalityRates (*this));
     InterestRates_ .reset(new InterestRates  (*this));
     DeathBfts_     .reset(new death_benefits (GetLength(), yare_input_));
-    Outlay_        .reset(new modal_outlay   (yare_input_));
+    Outlay_        .reset(new modal_outlay   (yare_input_, 
round_gross_premium_, round_withdrawal_, round_loan_));
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, database()));
     Loads_         .reset(new Loads(database(), IsSubjectToIllustrationReg()));
 
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index cec8a0a..c6ff672 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -228,8 +228,9 @@ void BasicValues::Init()
     MortalityRates_.reset(new MortalityRates (*this));
     InterestRates_ .reset(new InterestRates  (*this));
     DeathBfts_     .reset(new death_benefits (GetLength(), yare_input_));
-    // Outlay requires only input; it might someday use interest rates.
-    Outlay_        .reset(new modal_outlay   (yare_input_));
+    // Outlay requires only input and rounding; it might someday use
+    // interest rates.
+    Outlay_        .reset(new modal_outlay   (yare_input_, 
round_gross_premium_, round_withdrawal_, round_loan_));
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, 
StateOfDomicile_, yare_input_.AmortizePremiumLoad, database(), 
*StratifiedCharges_));
     Loads_         .reset(new Loads          (*this));
 
@@ -315,8 +316,9 @@ void BasicValues::GPTServerInit()
     MortalityRates_.reset(new MortalityRates (*this)); // Used by certain 
target-premium calculations.
 //  InterestRates_ .reset(new InterestRates  (*this));
 //  DeathBfts_     .reset(new death_benefits (GetLength(), yare_input_));
-    // Outlay requires only input; it might someday use interest rates.
-//  Outlay_        .reset(new modal_outlay   (yare_input_));
+    // Outlay requires only input and rounding; it might someday use
+    // interest rates.
+//  Outlay_        .reset(new modal_outlay   (yare_input_, 
round_gross_premium_, round_withdrawal_, round_loan_));
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, 
StateOfDomicile_, yare_input_.AmortizePremiumLoad, database(), 
*StratifiedCharges_));
     Loads_         .reset(new Loads          (*this));
 
diff --git a/outlay.cpp b/outlay.cpp
index 6da84d8..285478d 100644
--- a/outlay.cpp
+++ b/outlay.cpp
@@ -28,8 +28,16 @@
 
 #include <algorithm>
 
-modal_outlay::modal_outlay(yare_input const& yi)
-    :dumpin_               {yi.Dumpin}
+modal_outlay::modal_outlay
+    (yare_input       const& yi
+    ,round_to<double> const& round_gross_premium
+    ,round_to<double> const& round_withdrawal
+    ,round_to<double> const& round_loan
+    )
+    :round_gross_premium_  {round_gross_premium}
+    ,round_withdrawal_     {round_withdrawal}
+    ,round_loan_           {round_loan}
+    ,dumpin_               {yi.Dumpin}
     ,external_1035_amount_ {yi.External1035ExchangeAmount}
     ,internal_1035_amount_ {yi.Internal1035ExchangeAmount}
     ,ee_modal_premiums_    {yi.Payment}
diff --git a/outlay.hpp b/outlay.hpp
index 9e42803..fd4a361 100644
--- a/outlay.hpp
+++ b/outlay.hpp
@@ -25,6 +25,7 @@
 #include "config.hpp"
 
 #include "mc_enum_type_enums.hpp"
+#include "round_to.hpp"
 
 #include <vector>
 
@@ -35,7 +36,12 @@ class modal_outlay final
     friend class AccountValue;
 
   public:
-    explicit modal_outlay(yare_input const&);
+    explicit modal_outlay
+        (yare_input       const&
+        ,round_to<double> const& round_gross_premium
+        ,round_to<double> const& round_withdrawal
+        ,round_to<double> const& round_loan
+        );
     ~modal_outlay() = default;
 
     double                          dumpin               () const;
@@ -62,6 +68,10 @@ class modal_outlay final
     void set_withdrawals      (double z, int from_year, int to_year);
     void set_new_cash_loans   (double z, int from_year, int to_year);
 
+    round_to<double> round_gross_premium_;
+    round_to<double> round_withdrawal_;
+    round_to<double> round_loan_;
+
     double                   dumpin_;
     double                   external_1035_amount_;
     double                   internal_1035_amount_;



reply via email to

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