lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master ec7093b 22/25: Eradicate global iglp() and ig


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ec7093b 22/25: Eradicate global iglp() and igsp()
Date: Wed, 24 Feb 2021 19:00:55 -0500 (EST)

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

    Eradicate global iglp() and igsp()
---
 gpt_server.cpp       | 47 ++++-------------------------------------------
 irc7702_interest.cpp | 25 -------------------------
 irc7702_interest.hpp |  3 ---
 mec_server.cpp       | 48 ++++--------------------------------------------
 4 files changed, 8 insertions(+), 115 deletions(-)

diff --git a/gpt_server.cpp b/gpt_server.cpp
index 221d64b..dd1b5ad 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -185,50 +185,11 @@ gpt_state test_one_days_gpt_transactions
     max_coi_rate = 1.0 / max_coi_rate;
     assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
-#if 1
-    std::vector<double> guar_int;
-    database.query_into(DB_GuarInt, guar_int);
-
-    std::vector<double> const spread
-        (input.years_to_maturity()
-        ,stratified.minimum_tiered_spread_for_7702()
-        );
-
-    // ET !! Mly7702iGlp = i_upper_12_over_12_from_i(max(iglp(), guar_int) - 
spread);
-    std::vector<double> Mly7702iGlp(input.years_to_maturity());
-    assign
-        (Mly7702iGlp
-        ,apply_unary
-            (i_upper_12_over_12_from_i<double>()
-            ,apply_binary(greater_of<double>(), iglp(), guar_int) - spread
-            )
-        );
-    // TAXATION !! Similarly, GSP should be calculated, using igsp(), if
-    // this code is to be kept.
-
-    std::vector<double> Mly7702ig;
-    database.query_into(DB_NaarDiscount, Mly7702ig);
-    LMI_ASSERT(!contains(Mly7702ig, -1.0));
-    std::vector<double> DBDiscountRate(input.years_to_maturity());
-    assign(DBDiscountRate, 1.0 / (1.0 + Mly7702ig));
-
-    // Use zero if that's the guaranteed rate; else use the statutory rate.
-    std::vector<double> const zero(input.years_to_maturity(), 0.0);
-    std::vector<double> const& naar_disc_rate =
-          each_equal(Mly7702ig, 0.0)
-        ? zero
-        : Mly7702iGlp
-        ;
-#endif // 1
     i7702 const i7702_(database, stratified);
-    LMI_ASSERT(i7702_.gross  () == Mly7702ig);
-    LMI_ASSERT(i7702_.net_glp() == Mly7702iGlp);
-//  LMI_ASSERT(i7702_.net_gsp() == Mly7702iGsp);
-    LMI_ASSERT(i7702_.spread () == spread);
     ULCommFns commfns
         (Mly7702qc
-        ,Mly7702iGlp
-        ,naar_disc_rate
+        ,i7702_.net_glp()
+        ,i7702_.gross()   // 7702 !! should be ig()
         ,mce_option1_for_7702
         ,mce_monthly
         );
@@ -474,8 +435,8 @@ gpt_state test_one_days_gpt_transactions
         {
         ofs
             <<               j  << '\t'
-            << value_cast<std::string>(Mly7702iGlp    [j]) << '\t'
-            << value_cast<std::string>(naar_disc_rate [j]) << '\t'
+            << value_cast<std::string>(i7702_.net_glp() [j]) << '\t'
+            << value_cast<std::string>(i7702_.gross() [j]) << '\t'
             << value_cast<std::string>(Mly7702qc      [j]) << '\t'
             << value_cast<std::string>(commfns.aD()   [j]) << '\t'
             << value_cast<std::string>(commfns.kC()   [j]) << '\t'
diff --git a/irc7702_interest.cpp b/irc7702_interest.cpp
index aa0b2f8..2e533cb 100644
--- a/irc7702_interest.cpp
+++ b/irc7702_interest.cpp
@@ -23,37 +23,12 @@
 
 #include "irc7702_interest.hpp"
 
-#include "contains.hpp"                 // 7702 !! obsolescent
 #include "database.hpp"
 #include "et_vector.hpp"
-#include "global_settings.hpp"          // 7702 !! obsolescent
 #include "math_functions.hpp"
 #include "miscellany.hpp"               // each_equal()
 #include "stratified_charges.hpp"
 
-/// Statutory interest rate for 7702 and 7702A (except GSP).
-///
-/// Conditionally use the H.R. 6800 transitional rates. See:
-///   https://www.congress.gov/bill/116th-congress/house-bill/6800/text
-
-double iglp()
-{
-    static bool const hr6800 =
-           global_settings::instance().ash_nazg()
-        && contains(global_settings::instance().pyx(), "HR6800")
-        ;
-    return hr6800 ? 0.02 : 0.04;
-}
-
-/// Statutory interest rate for 7702 (GSP only).
-///
-/// Implemented in terms of iglp(), q.v.
-
-double igsp()
-{
-    return 0.02 + iglp();
-}
-
 i7702::i7702
     (product_database   const& database
     ,stratified_charges const& stratified
diff --git a/irc7702_interest.hpp b/irc7702_interest.hpp
index 2f3ea41..c1d71ca 100644
--- a/irc7702_interest.hpp
+++ b/irc7702_interest.hpp
@@ -31,9 +31,6 @@
 class LMI_SO_FWD_DECL product_database;
 class LMI_SO_FWD_DECL stratified_charges;
 
-LMI_SO double iglp(); // 7702 !! obsolescent
-LMI_SO double igsp(); // 7702 !! obsolescent
-
 class LMI_SO i7702 final
 {
   public:
diff --git a/mec_server.cpp b/mec_server.cpp
index ddd7a9e..112c82d 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -168,51 +168,11 @@ mec_state test_one_days_7702A_transactions
     max_coi_rate = 1.0 / max_coi_rate;
     assign(Mly7702qc, apply_binary(coi_rate_from_q<double>(), Mly7702qc, 
max_coi_rate));
 
-#if 1
-    std::vector<double> guar_int;
-    database.query_into(DB_GuarInt, guar_int);
-
-    std::vector<double> const spread
-        (input.years_to_maturity()
-        ,stratified.minimum_tiered_spread_for_7702()
-        );
-
-    // ET !! Mly7702iGlp = i_upper_12_over_12_from_i(max(iglp(), guar_int) - 
spread);
-    std::vector<double> Mly7702iGlp(input.years_to_maturity());
-    assign
-        (Mly7702iGlp
-        ,apply_unary
-            (i_upper_12_over_12_from_i<double>()
-            ,apply_binary(greater_of<double>(), iglp(), guar_int) - spread
-            )
-        );
-
-    std::vector<double> Mly7702ig;
-    database.query_into(DB_NaarDiscount, Mly7702ig);
-    LMI_ASSERT(!contains(Mly7702ig, -1.0));
-    std::vector<double> DBDiscountRate(input.years_to_maturity());
-    assign(DBDiscountRate, 1.0 / (1.0 + Mly7702ig));
-
-    // Use zero if that's the guaranteed rate; else use the statutory rate.
-    std::vector<double> const zero(input.years_to_maturity(), 0.0);
-    std::vector<double> const& naar_disc_rate =
-          each_equal(Mly7702ig, 0.0)
-        ? zero
-        : Mly7702iGlp
-        ;
-#endif // 1
     i7702 const i7702_(database, stratified);
-//  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);
     ULCommFns commfns
         (Mly7702qc
-        ,Mly7702iGlp
-        ,naar_disc_rate
+        ,i7702_.net_glp() // 7702 !! should be gross()
+        ,i7702_.gross()   // 7702 !! should be ig()
         ,mce_option1_for_7702
         ,mce_monthly
         );
@@ -458,8 +418,8 @@ mec_state test_one_days_7702A_transactions
         {
         ofs
             <<               j  << '\t'
-            << value_cast<std::string>(Mly7702iGlp    [j]) << '\t'
-            << value_cast<std::string>(naar_disc_rate [j]) << '\t'
+            << value_cast<std::string>(i7702_.net_glp() [j]) << '\t'
+            << value_cast<std::string>(i7702_.gross() [j]) << '\t'
             << value_cast<std::string>(Mly7702qc      [j]) << '\t'
             << value_cast<std::string>(commfns.aD()   [j]) << '\t'
             << value_cast<std::string>(commfns.kC()   [j]) << '\t'



reply via email to

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