lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/005 9c2b0ad 3/5: Make NAAR currency, not dou


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/005 9c2b0ad 3/5: Make NAAR currency, not double
Date: Thu, 28 Jan 2021 17:53:34 -0500 (EST)

branch: valyuta/005
commit 9c2b0ad84fb0854d3fa55ed7751ac490307a2502
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Make NAAR currency, not double
    
    Incidentally imported some macro-conditionalized code from master,
    to eliminate a gratuitous incompatibility.
---
 account_value.hpp |  2 +-
 accountvalue.cpp  |  2 +-
 ihs_avmly.cpp     | 10 +++++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/account_value.hpp b/account_value.hpp
index 9f586dd..c5888cc 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -420,7 +420,7 @@ class LMI_SO AccountValue final
     currency SepAcctValueAfterDeduction;
     double   GenAcctPaymentAllocation;
     double   SepAcctPaymentAllocation;
-    double   NAAR; // CURRENCY !! not currency?
+    currency NAAR;
     currency CoiCharge;
     currency RiderCharges;
     currency NetCoiCharge;
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 7787cc6..0e737b0 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -779,7 +779,7 @@ void AccountValue::TxSetCoiCharge()
     TxSetDeathBft();
 
     // Negative AV doesn't increase NAAR.
-    NAAR = round_naar()(deathbft * mlyguarv - dblize(AVUnloaned + AVRegLn + 
AVPrfLn));
+    NAAR = round_naar().c(deathbft * mlyguarv - dblize(AVUnloaned + AVRegLn + 
AVPrfLn));
 
     CoiCharge = round_coi_charge().c(NAAR * YearsCoiRate0);
 }
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index 879e583..47dbc8b 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -1786,11 +1786,19 @@ void AccountValue::TxSetCoiCharge()
     // than zero because the corridor factor can be as low as unity,
     // but it's constrained to be nonnegative to prevent increasing
     // the account value by deducting a negative mortality charge.
+#if defined USE_CURRENCY_CLASS
+    NAAR = round_naar().c
+        (  DBReflectingCorr * DBDiscountRate[Year]
+        - dblize(std::max(C0, TotalAccountValue()))
+        );
+    NAAR = std::max(C0, NAAR);
+#else  // !defined USE_CURRENCY_CLASS
     NAAR = material_difference
         (DBReflectingCorr * DBDiscountRate[Year]
-        ,std::max(0.0, dblize(TotalAccountValue()))
+        ,std::max(0.0, TotalAccountValue())
         );
     NAAR = std::max(0.0, round_naar()(NAAR));
+#endif // !defined USE_CURRENCY_CLASS
 
 // TODO ?? This doesn't work. We need to reconsider the basic transactions.
 //  currency naar_forceout = std::max(0.0, NAAR - MaxNAAR);



reply via email to

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