[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7930f69 20/24: Set 7702 and 7702A interest ra
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7930f69 20/24: Set 7702 and 7702A interest rates OAOO |
Date: |
Wed, 30 Dec 2020 18:47:01 -0500 (EST) |
branch: master
commit 7930f6929183c06ad7385bae59a0805c78d82278
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Set 7702 and 7702A interest rates OAOO
These rates are about to change; imbuing them with the OAOO nature now
makes a correct change in their values more likely.
---
Makefile.am | 1 +
gpt_server.cpp | 5 ++++-
gpt_test.cpp | 5 +++--
ihs_basicval.cpp | 5 +++--
interest_rates.cpp | 9 +++++----
irc7702_interest.hpp | 43 +++++++++++++++++++++++++++++++++++++++++++
irc7702_tables.cpp | 9 +++++----
mec_server.cpp | 3 ++-
8 files changed, 66 insertions(+), 14 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index d8545b2..ea351f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1358,6 +1358,7 @@ noinst_HEADERS = \
input_sequence_parser.hpp \
interest_rates.hpp \
interpolate_string.hpp \
+ irc7702_interest.hpp \
irc7702_tables.hpp \
istream_to_string.hpp \
ledger.hpp \
diff --git a/gpt_server.cpp b/gpt_server.cpp
index aa4e2a5..04f6b09 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -38,6 +38,7 @@
#include "ieee754.hpp" // ldbl_eps_plus_one_times()
#include "ihs_irc7702a.hpp"
#include "ihs_server7702.hpp" // RunServer7702FromStruct()
+#include "irc7702_interest.hpp" // iglp(), igsp()
#include "materially_equal.hpp" // material_difference()
#include "math_functions.hpp"
#include "mc_enum_types_aux.hpp" // mc_state_from_string()
@@ -197,9 +198,11 @@ gpt_state test_one_days_gpt_transactions
(Mly7702iGlp
,apply_unary
(i_upper_12_over_12_from_i<double>()
- ,apply_binary(greater_of<double>(), 0.04, guar_int) - spread
+ ,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);
diff --git a/gpt_test.cpp b/gpt_test.cpp
index d590979..2f8420c 100644
--- a/gpt_test.cpp
+++ b/gpt_test.cpp
@@ -26,6 +26,7 @@
#include "assert_lmi.hpp"
#include "cso_table.hpp"
+#include "irc7702_interest.hpp" // iglp(), igsp()
#include "materially_equal.hpp"
#include "math_functions.hpp"
#include "ssize_lmi.hpp"
@@ -236,8 +237,8 @@ class gpt_test
void gpt_test::initialize(int issue_age)
{
- static double const i_m_4 = i_upper_12_over_12_from_i<double>()(0.04);
- static double const i_m_6 = i_upper_12_over_12_from_i<double>()(0.06);
+ static double const i_m_4 = i_upper_12_over_12_from_i<double>()(iglp());
+ static double const i_m_6 = i_upper_12_over_12_from_i<double>()(igsp());
q_m = sample_q(issue_age);
int const length = lmi::ssize(q_m);
glp_ic .assign(length, i_m_4);
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 48ab827..9911d90 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -41,6 +41,7 @@
#include "ihs_irc7702a.hpp"
#include "input.hpp"
#include "interest_rates.hpp"
+#include "irc7702_interest.hpp" // iglp(), igsp()
#include "lingo.hpp"
#include "loads.hpp"
#include "math_functions.hpp"
@@ -446,7 +447,7 @@ void BasicValues::Init7702()
(Mly7702iGlp
,apply_unary
(i_upper_12_over_12_from_i<double>()
- ,apply_binary(greater_of<double>(), 0.04, guar_int) -
SpreadFor7702_
+ ,apply_binary(greater_of<double>(), iglp(), guar_int) -
SpreadFor7702_
)
);
@@ -455,7 +456,7 @@ void BasicValues::Init7702()
(Mly7702iGsp
,apply_unary
(i_upper_12_over_12_from_i<double>()
- ,apply_binary(greater_of<double>(), 0.06, guar_int) -
SpreadFor7702_
+ ,apply_binary(greater_of<double>(), igsp(), guar_int) -
SpreadFor7702_
)
);
diff --git a/interest_rates.cpp b/interest_rates.cpp
index 69001aa..7a797fe 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -28,6 +28,7 @@
#include "basic_values.hpp"
#include "database.hpp"
#include "dbnames.hpp"
+#include "irc7702_interest.hpp" // iglp(), igsp()
#include "math_functions.hpp" // assign_midpoint()
#include "miscellany.hpp" // each_equal()
#include "ssize_lmi.hpp"
@@ -1022,12 +1023,12 @@ void InterestRates::Initialize7702Rates()
std::vector<double> const& annual_guar_rate =
GenAcctGrossRate_[mce_gen_guar];
MlyGlpRate_.resize(Length_);
- // ET !! MlyGlpRate_ = max(0.04, annual_guar_rate);
+ // ET !! MlyGlpRate_ = max(iglp(), annual_guar_rate);
std::transform
(annual_guar_rate.begin()
,annual_guar_rate.end()
,MlyGlpRate_.begin()
- ,[](double x) { return std::max(0.04, x); }
+ ,[](double x) { return std::max(iglp(), x); }
);
// ET !! This ought to be implicit, at least in some 'safe' mode:
LMI_ASSERT(MlyGlpRate_.size() == SpreadFor7702_.size());
@@ -1099,7 +1100,7 @@ void InterestRates::Initialize7702Rates()
*/
// ET !! Mly7702iGlp = i_upper_12_over_12_from_i(max(.04, guar_int) -
SpreadFor7702_);
- Mly7702iGlp.assign(Length, 0.04);
+ Mly7702iGlp.assign(Length, iglp());
std::transform
(guar_int.begin()
,guar_int.end()
@@ -1122,7 +1123,7 @@ void InterestRates::Initialize7702Rates()
);
// ET !! Mly7702iGlp = i_upper_12_over_12_from_i(max(.06, guar_int) -
SpreadFor7702_);
- Mly7702iGsp.assign(Length, 0.06);
+ Mly7702iGsp.assign(Length, igsp());
std::transform
(guar_int.begin()
,guar_int.end()
diff --git a/irc7702_interest.hpp b/irc7702_interest.hpp
new file mode 100644
index 0000000..547b4da
--- /dev/null
+++ b/irc7702_interest.hpp
@@ -0,0 +1,43 @@
+// 7702 (and 7702A) interest rates.
+//
+// Copyright (C) 2020 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#ifndef irc7702_interest_hpp
+#define irc7702_interest_hpp
+
+#include "config.hpp"
+
+#include "so_attributes.hpp"
+
+/// Statutory interest rate for 7702 and 7702A (except GSP).
+
+LMI_SO inline double iglp()
+{
+ return 0.04;
+}
+
+/// Statutory interest rate for 7702 (GSP only).
+
+LMI_SO inline double igsp()
+{
+ return 0.02 + iglp();
+}
+
+#endif // irc7702_interest_hpp
diff --git a/irc7702_tables.cpp b/irc7702_tables.cpp
index 54c386b..d2ecade 100644
--- a/irc7702_tables.cpp
+++ b/irc7702_tables.cpp
@@ -27,6 +27,7 @@
#include "commutation_functions.hpp"
#include "cso_table.hpp"
#include "et_vector.hpp"
+#include "irc7702_interest.hpp" // iglp()
#include "math_functions.hpp"
#include "ssize_lmi.hpp"
@@ -54,12 +55,12 @@ irc7702_tables::irc7702_tables
std::vector<double> q12(length_);
assign(q12, apply_binary(coi_rate_from_q<double>(), q_, max_coi_rate));
- // ic: 0.04 is the statutory rate.
+ // ic: iglp() is the statutory rate.
// ig: Argument 'naar_discount' corresponds to DB_NaarDiscount,
// which is assumed to be rounded appropriately if at all.
std::vector<double> const ic
(length_
- ,i_upper_12_over_12_from_i<double>()(0.04)
+ ,i_upper_12_over_12_from_i<double>()(iglp())
);
std::vector<double> const& ig(naar_discount);
@@ -77,8 +78,8 @@ irc7702_tables::irc7702_tables
E7aN.erase(E7aN.begin(), 7 + E7aN.begin());
ul_7pp_ += (ulcf.aDomega() + ulcf.kM()) / (ulcf.aN() - E7aN);
- double const i_over_delta = 0.04 / std::log(1.04);
- std::vector<double> const i(length_, 0.04);
+ double const i_over_delta = iglp() / std::log(1 + iglp());
+ std::vector<double> const i(length_, iglp());
OLCommFns const olcf(q_, i);
// Alternative calculations that may be useful someday are given
diff --git a/mec_server.cpp b/mec_server.cpp
index 4345919..ac22016 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -35,6 +35,7 @@
#include "et_vector.hpp"
#include "ieee754.hpp" // ldbl_eps_plus_one_times()
#include "ihs_irc7702a.hpp"
+#include "irc7702_interest.hpp" // iglp()
#include "materially_equal.hpp" // material_difference()
#include "math_functions.hpp"
#include "mc_enum_types_aux.hpp" // mc_state_from_string()
@@ -180,7 +181,7 @@ mec_state test_one_days_7702A_transactions
(Mly7702iGlp
,apply_unary
(i_upper_12_over_12_from_i<double>()
- ,apply_binary(greater_of<double>(), 0.04, guar_int) - spread
+ ,apply_binary(greater_of<double>(), iglp(), guar_int) - spread
)
);
- [lmi-commits] [lmi] master 3121c90 23/24: Conditionally use H.R. 6800's 7702 transitional rates, (continued)
- [lmi-commits] [lmi] master 3121c90 23/24: Conditionally use H.R. 6800's 7702 transitional rates, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 3ee0c70 15/24: Make two member functions identical, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master d7f3337 09/24: Move a block of code as just announced, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master d4e0291 10/24: Refactor, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 71d750e 14/24: Make two member functions almost identical, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master a473a82 17/24: Expunge a duplicative member function [325], Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 2bc3d08 02/24: Move an enum, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master b3cbe37 11/24: Move another block of code, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 9180696 16/24: Change a member's type-specifier, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 3ee62a7 19/24: Read product data files earlier, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master 7930f69 20/24: Set 7702 and 7702A interest rates OAOO,
Greg Chicares <=
- [lmi-commits] [lmi] master d6701e8 21/24: Split a unit-test TU in twain, Greg Chicares, 2020/12/30
- [lmi-commits] [lmi] master e1047b3 24/24: Record speed measurements, Greg Chicares, 2020/12/30