lmi-commits
[Top][All Lists]
Advanced

[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"



reply via email to

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