lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 5afe8dc 6/7: Round values in class modal_outl


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5afe8dc 6/7: Round values in class modal_outlay
Date: Sun, 23 Aug 2020 18:00:52 -0400 (EDT)

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

    Round values in class modal_outlay
    
    This happens to have no effect on lmi's regression testing, which
    doesn't encompass improbabilities like paying pi dollars. However, it
    does have an effect that can be seen by entering payments in fractional
    cents, or by changing the gross-payment rounding rule (say, downward to
    whole dollars) and running a regression test.
---
 outlay.cpp | 28 ++++++++++++++++------------
 outlay.hpp |  4 ++--
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/outlay.cpp b/outlay.cpp
index 285478d..88ab2fb 100644
--- a/outlay.cpp
+++ b/outlay.cpp
@@ -35,42 +35,46 @@ modal_outlay::modal_outlay
     ,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}
-    ,ee_premium_modes_     {yi.PaymentMode}
-    ,er_modal_premiums_    {yi.CorporationPayment}
-    ,er_premium_modes_     {yi.CorporationPaymentMode}
-    ,withdrawals_          {yi.Withdrawal}
-    ,new_cash_loans_       {yi.NewLoan}
+    ,round_withdrawal_     {round_withdrawal   }
+    ,round_loan_           {round_loan         }
+    ,dumpin_               {round_gross_premium_(yi.Dumpin)                    
}
+    ,external_1035_amount_ 
{round_gross_premium_(yi.External1035ExchangeAmount)}
+    ,internal_1035_amount_ 
{round_gross_premium_(yi.Internal1035ExchangeAmount)}
+    ,ee_modal_premiums_    {round_gross_premium_(yi.Payment)                   
}
+    ,ee_premium_modes_     {                     yi.PaymentMode                
}
+    ,er_modal_premiums_    {round_gross_premium_(yi.CorporationPayment)        
}
+    ,er_premium_modes_     {                     yi.CorporationPaymentMode     
}
+    ,withdrawals_          {round_withdrawal_   (yi.Withdrawal)                
}
+    ,new_cash_loans_       {round_loan_         (yi.NewLoan)                   
}
 {
 }
 
 void modal_outlay::set_ee_modal_premiums(double z, int from_year, int to_year)
 {
+    z = round_gross_premium_(z);
     std::fill_n(ee_modal_premiums_.begin() + from_year, to_year - from_year, 
z);
 }
 
 void modal_outlay::set_er_modal_premiums(double z, int from_year, int to_year)
 {
+    z = round_gross_premium_(z);
     std::fill_n(er_modal_premiums_.begin() + from_year, to_year - from_year, 
z);
 }
 
 void modal_outlay::set_er_modal_premiums(std::vector<double> const& z)
 {
     LMI_ASSERT(z.size() == er_modal_premiums_.size());
-    er_modal_premiums_ = z;
+    er_modal_premiums_ = round_gross_premium_(z);
 }
 
 void modal_outlay::set_withdrawals(double z, int from_year, int to_year)
 {
+    z = round_withdrawal_(z);
     std::fill_n(withdrawals_.begin() + from_year, to_year - from_year, z);
 }
 
 void modal_outlay::set_new_cash_loans(double z, int from_year, int to_year)
 {
+    z = round_loan_(z);
     std::fill_n(new_cash_loans_.begin() + from_year, to_year - from_year, z);
 }
diff --git a/outlay.hpp b/outlay.hpp
index fd4a361..f8baf36 100644
--- a/outlay.hpp
+++ b/outlay.hpp
@@ -130,12 +130,12 @@ inline std::vector<double> const& 
modal_outlay::new_cash_loans() const
 
 inline void modal_outlay::set_external_1035_amount(double z)
 {
-    external_1035_amount_ = z;
+    external_1035_amount_ = round_gross_premium_(z);
 }
 
 inline void modal_outlay::set_internal_1035_amount(double z)
 {
-    internal_1035_amount_ = z;
+    internal_1035_amount_ = round_gross_premium_(z);
 }
 
 #endif // outlay_hpp



reply via email to

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