[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/007 1189d3ac 05/10: Change a ledger field to
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/007 1189d3ac 05/10: Change a ledger field to cents |
Date: |
Tue, 19 Apr 2022 19:00:41 -0400 (EDT) |
branch: valyuta/007
commit 1189d3acda0d1de0a72f29681d86b717c7a7a2db
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Change a ledger field to cents
Changed 'BaseDeathBft' from decimal dollars to integral cents.
Example from '.test' file for first cell in 'sample' census:
- 1056399.02000000001863
+ 105639902
- 1129424.70999999996275
+ 112942471
The data were already integral numbers of cents, but holding them as
decimal dollars in the ledger object introduced roundoff error.
Chose 'BaseDeathBft' for this proof of concept because its value is
never read back from the ledger object to class AccountValue. Some
other data are, and therefore will require adjustment.
---
ihs_acctval.cpp | 2 +-
ledger_evaluator.cpp | 3 ++-
ledger_text_formats.cpp | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index b076b6db..79c562e6 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -1247,7 +1247,7 @@ void AccountValue::FinalizeYear()
InvariantValues().TermSpecAmt [Year] = dblize(TermSpecAmt);
VariantValues().TermPurchased [Year] = dblize(TermDB);
// Add term rider DB
- VariantValues().BaseDeathBft [Year] = dblize(DBReflectingCorr);
+ VariantValues().BaseDeathBft [Year] = centize(DBReflectingCorr);
VariantValues().EOYDeathBft [Year] = dblize(DBReflectingCorr + TermDB);
// Monthly deduction detail
diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index 6f5f128e..7a874704 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -435,6 +435,7 @@ format_map_t static_formats()
std::pair<int,oenum_format_style> f2(2, oe_format_normal);
std::pair<int,oenum_format_style> f3(0, oe_format_percentage);
std::pair<int,oenum_format_style> f4(2, oe_format_percentage);
+ std::pair<int,oenum_format_style> f5(0, oe_cents_as_dollars);
static format_map_t const format_map =
// > Special Formatting for Scalar Items
@@ -619,7 +620,7 @@ format_map_t static_formats()
,{"AddonCompOnPremium" , f1}
,{"AvgDeathBft" , f1}
,{"BOYAssets" , f1}
- ,{"BaseDeathBft" , f1}
+ ,{"BaseDeathBft" , f5}
,{"COICharge" , f1}
,{"CSVNet" , f1}
,{"CV7702" , f1}
diff --git a/ledger_text_formats.cpp b/ledger_text_formats.cpp
index 4a9293dd..faff097b 100644
--- a/ledger_text_formats.cpp
+++ b/ledger_text_formats.cpp
@@ -94,8 +94,8 @@ std::map<std::string,ledger_metadata> const&
ledger_metadata_map()
m["CSVNet_Guaranteed" ] = ledger_metadata(0, oe_format_normal
, "Guar Net Cash Surr Value" ); // "Guaranteed Cash Surrender
Value"
m["EOYDeathBft_Current" ] = ledger_metadata(0, oe_format_normal
, "Curr EOY Death Benefit" ); // "Current Death Benefit"
m["EOYDeathBft_Guaranteed" ] = ledger_metadata(0, oe_format_normal
, "Guar EOY Death Benefit" ); // "Guaranteed Death Benefit"
- m["BaseDeathBft_Current" ] = ledger_metadata(0, oe_format_normal
, "Curr Base Death Benefit" ); // "Current Base Death Benefit"
- m["BaseDeathBft_Guaranteed" ] = ledger_metadata(0, oe_format_normal
, "Guar Base Death Benefit" ); // "Guaranteed Base Death
Benefit"
+ m["BaseDeathBft_Current" ] = ledger_metadata(0,
oe_cents_as_dollars , "Curr Base Death Benefit" ); // "Current
Base Death Benefit"
+ m["BaseDeathBft_Guaranteed" ] = ledger_metadata(0,
oe_cents_as_dollars , "Guar Base Death Benefit" ); // "Guaranteed
Base Death Benefit"
m["TermPurchased_Current" ] = ledger_metadata(0, oe_format_normal
, "Curr Term Amt Purchased" ); // "Current Term Purchased"
m["TermPurchased_Guaranteed" ] = ledger_metadata(0, oe_format_normal
, "Guar Term Amt Purchased" ); // "Guaranteed Term Purchased"
m["SupplDeathBft_Current" ] = ledger_metadata(0, oe_format_normal
, "Curr Suppl Death Benefit" ); // "Current Supplemental Death
Benefit"
- [lmi-commits] [lmi] valyuta/007 updated (4c404956 -> 0b887792), Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 18a91e63 01/10: Fix dblize()ation in commented-out code, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 efa7b7a8 02/10: Add a helper function with a deliberately ugly name, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 1aeae253 03/10: Add a unit test for ledger_format(), Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 c55ec8f6 04/10: Add an option to format cents as decimal dollars, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 6569915e 06/10: Reformat, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 0b887792 10/10: Change many more ledger fields to cents, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 7b3debe3 07/10: Add a 'divisor' argument to LedgerBase::value_str(), Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 7535505d 09/10: Change several more ledger fields to cents, Greg Chicares, 2022/04/19
- [lmi-commits] [lmi] valyuta/007 1189d3ac 05/10: Change a ledger field to cents,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/007 2d26a146 08/10: Change several more ledger fields to cents, Greg Chicares, 2022/04/19