lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master ceaa572 6/7: Round apportioned AV decrements


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ceaa572 6/7: Round apportioned AV decrements
Date: Wed, 26 Aug 2020 20:09:02 -0400 (EDT)

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

    Round apportioned AV decrements
---
 ihs_avmly.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index 330aaeb..0b5ec85 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -412,6 +412,8 @@ void AccountValue::process_distribution(double decrement)
 
 void AccountValue::DecrementAVProportionally(double decrement)
 {
+    decrement = round_minutiae()(decrement);
+
     if(materially_equal(decrement, AVGenAcct + AVSepAcct))
         {
         AVGenAcct = 0.0;
@@ -451,8 +453,14 @@ void AccountValue::DecrementAVProportionally(double 
decrement)
             ,1.0
             )
         );
-    AVGenAcct -= decrement * general_account_proportion;
-    AVSepAcct -= decrement * separate_account_proportion;
+    // Disregard 'separate_account_proportion' in order to ensure
+    // that the sum of the distinct decrements here equals the
+    // total decrement. Keep 'separate_account_proportion' above
+    // because there may still be value in the assertions.
+    double genacct_decrement = decrement * general_account_proportion;
+    genacct_decrement = round_minutiae()(genacct_decrement);
+    AVGenAcct -= genacct_decrement;
+    AVSepAcct -= decrement - genacct_decrement;
 }
 
 /// Apportion decrements to account value between separate- and



reply via email to

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