[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master d17fda2 20/25: Bring bogosity into focus befo
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master d17fda2 20/25: Bring bogosity into focus before eradicating it |
Date: |
Wed, 24 Feb 2021 19:00:54 -0500 (EST) |
branch: master
commit d17fda2ba6d28b3a5288c68e8396d05b32f43e95
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Bring bogosity into focus before eradicating it
Split 7702 interest into its four necessary components:
- gross: greater of statutory or guaranteed
- net GLP: gross minus applicable sep acct load
- net GSP: max(stat + 2%, guar) - applicable sep acct load
- ig: the symbol 'ig' in Eckley's paper
and one unnecessary one:
- bogus: interest rate for contractual NAAR discount
The "bogus" rate is to be used only for "refactoring", to ensure
that soon-to-be-replaced code can be eradicated without regression.
Then a correction will be applied, inducing regressions.
---
irc7702_interest.cpp | 25 +++++++++++++++++++++++--
irc7702_interest.hpp | 5 +++++
mec_server.cpp | 5 ++++-
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/irc7702_interest.cpp b/irc7702_interest.cpp
index 212883e..aa0b2f8 100644
--- a/irc7702_interest.cpp
+++ b/irc7702_interest.cpp
@@ -136,6 +136,27 @@ i7702::i7702
)
);
- // 7702 !! WRONG: for 7702, Eckley's 'ig' must be 'gross_' as set above
- database_.query_into(DB_NaarDiscount, gross_);
+ // Eckley's 'ig' represents the interest rate by which death
+ // benefit is discounted for calculating mortality charges,
+ // as seen in his formula (1):
+ // [0V + P - Q(1/(1 + ig) - OV - P)] (1 + ic) = 1V
+ // For 7702, that 'ig' should generally be 'gross_' above.
+ //
+ // However, if the contract applies no such discount, then 'ig'
+ // must be zero for formula (1) to apply. As of 2021-02, lmi
+ // supports one ancient product that seems to have no such
+ // discount. This is so extraordinary that it doesn't merit
+ // a special database flag. Instead, the discount is deemed
+ // to be absent iff the contractual discount according to the
+ // product database is uniformly zero.
+
+ std::vector<double> const zero(database_.length(), 0.0);
+ std::vector<double> contractual_naar_discount;
+ database_.query_into(DB_NaarDiscount, contractual_naar_discount);
+ ig_ = (zero == contractual_naar_discount) ? zero : gross_;
+
+ // 7702 !! For the nonce, use this in place of 'ig_' even though
+ // that is wrong, because correcting it in certain old code causes
+ // regressions that will take some effort to resolve.
+ bogus_ = contractual_naar_discount;
}
diff --git a/irc7702_interest.hpp b/irc7702_interest.hpp
index 89845d5..2f3ea41 100644
--- a/irc7702_interest.hpp
+++ b/irc7702_interest.hpp
@@ -45,9 +45,11 @@ class LMI_SO i7702 final
i7702& operator=(i7702 const&) = delete;
~i7702() = default;
+ std::vector<double> const& ig () const {return ig_; }
std::vector<double> const& gross () const {return gross_; }
std::vector<double> const& net_glp() const {return net_glp_;}
std::vector<double> const& net_gsp() const {return net_gsp_;}
+ std::vector<double> const& bogus () const {return bogus_; }
// 7702 !! ephemeral
std::vector<double> const& spread() const {return spread_;}
@@ -58,9 +60,12 @@ class LMI_SO i7702 final
std::vector<double> spread_;
+ std::vector<double> ig_ ;
std::vector<double> gross_ ;
std::vector<double> net_glp_;
std::vector<double> net_gsp_;
+ // 7702 !! deprecated:
+ std::vector<double> bogus_ ;
};
#endif // irc7702_interest_hpp
diff --git a/mec_server.cpp b/mec_server.cpp
index 4431688..ddd7a9e 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -202,7 +202,10 @@ mec_state test_one_days_7702A_transactions
;
#endif // 1
i7702 const i7702_(database, stratified);
- LMI_ASSERT(i7702_.gross () == Mly7702ig);
+// LMI_ASSERT(i7702_.gross () == Mly7702ig); // should fail, and does fail
+// LMI_ASSERT(i7702_.ig () == Mly7702ig); // should succeed, but fails
+ LMI_ASSERT(i7702_.bogus () == Mly7702ig); // succeeds, but bogusly
+ LMI_ASSERT(i7702_.gross () == naar_disc_rate);
LMI_ASSERT(i7702_.net_glp() == Mly7702iGlp);
// LMI_ASSERT(i7702_.net_gsp() == Mly7702iGsp);
LMI_ASSERT(i7702_.spread () == spread);
- [lmi-commits] [lmi] master updated (a62fbec -> 2f74b41), Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 04484e6 03/25: Remove a duplicative defect marker [300], Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 671e3f2 05/25: Almost move two blocks of code, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3ba52f9 01/25: Add a '7702 !!' marker for new 7702 issues, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 447290e 04/25: Move an assertion; rewrite and duplicate its comment, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 5dbf2e3 06/25: Validate class i7702, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 2f74b41 25/25: Improve encapsulation of 7702 "spread", Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3a06237 08/25: Deduplicate, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 3c341a6 10/25: Remove more dead code, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master e6f9397 14/25: Obtain DCV interest rate from i7702 object, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master d17fda2 20/25: Bring bogosity into focus before eradicating it,
Greg Chicares <=
- [lmi-commits] [lmi] master bbe2802 21/25: Reduce bogosity ever so slightly, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 8c27092 24/25: Use correct interest rates for '.mec' input, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 7cf8204 02/25: Add a 7702 interest-rate class, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ef22f46 07/25: Deduplicate [295], Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 6bde573 12/25: Make certain shared_ptr members const, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ee8667d 13/25: Turn a local variable into a member, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 9f5c39d 15/25: Expunge disused accessors, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 8db602c 16/25: Turn several members into local variables, Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master 87af00c 19/25: Support a further "refactoring", Greg Chicares, 2021/02/24
- [lmi-commits] [lmi] master ad762d4 18/25: Remove dead code, Greg Chicares, 2021/02/24