[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
- [lmi-commits] [lmi] master updated (061fa21 -> 110f4b9), Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master a5279b7 5/7: Round gross and net withdrawals, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master 110f4b9 7/7: Round apportioned AV increments, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master 2b902eb 1/7: Refactor for clarity, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master 3453e8d 2/7: Rename a local variable, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master d618023 3/7: Preserve total specamt when apportioning changes, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master 53ebc6f 4/7: Round changes to specamt, Greg Chicares, 2020/08/26
- [lmi-commits] [lmi] master ceaa572 6/7: Round apportioned AV decrements,
Greg Chicares <=