[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ff69044 1/2: Round policy fees
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ff69044 1/2: Round policy fees |
Date: |
Tue, 25 Aug 2020 06:24:21 -0400 (EDT) |
branch: master
commit ff690440c25a3c593ebbb8031427a38cadd30f2b
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Round policy fees
This prevents midpoint account values from assuming values in half-cents
for some actual products.
---
loads.cpp | 13 +++++++++++++
loads_impl.hpp | 6 ++++++
loads_test.cpp | 6 ++++--
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/loads.cpp b/loads.cpp
index 8e9873f..4ddf8cb 100644
--- a/loads.cpp
+++ b/loads.cpp
@@ -54,6 +54,7 @@ Loads::Loads(BasicValues& V)
,V.database().query<oenum_asset_charge_type>(DB_AssetChargeType)
,V.IsSubjectToIllustrationReg()
,V.round_interest_rate()
+ ,V.round_minutiae()
,V.yare_input_.ExtraCompensationOnPremium
,V.yare_input_.ExtraCompensationOnAssets
,V.yare_input_.ExtraMonthlyCustodialFee
@@ -309,6 +310,18 @@ void Loads::Calculate(load_details const& details)
assign_midpoint(target_total_load_ [mce_gen_mdpt],
target_total_load_ [mce_gen_guar], target_total_load_ [mce_gen_curr]);
assign_midpoint(excess_total_load_ [mce_gen_mdpt],
excess_total_load_ [mce_gen_guar], excess_total_load_ [mce_gen_curr]);
}
+
+ // Round policy fees. No known product specifies any policy fee
+ // in fractional cents. However, if the monthly policy fee is
+ // $3.25 (current) and $5.00 (guaranteed), the midpoint shouldn't
+ // be $4.125, because subtracting that from the account value
+ // would make it a non-integral number of cents.
+
+ for(int j = mce_gen_curr; j < mc_n_gen_bases; ++j)
+ {
+ monthly_policy_fee_ [j] = details.round_minutiae_(monthly_policy_fee_
[j]);
+ annual_policy_fee_ [j] = details.round_minutiae_(annual_policy_fee_
[j]);
+ }
}
/// Amortize premium tax.
diff --git a/loads_impl.hpp b/loads_impl.hpp
index 7287583..7fd9a88 100644
--- a/loads_impl.hpp
+++ b/loads_impl.hpp
@@ -62,6 +62,9 @@ class product_database;
/// charge--it is expressed annually, converted to monthly in the
/// implementation, and then must be rounded.
///
+/// round_minutiae_: Rounding function-object used for policy fees,
+/// which generally are an integral number of cents.
+///
/// VectorExtraCompLoad_: Input extra load per dollar of premium.
///
/// VectorExtraAssetComp_: Input extra load per dollar of assets.
@@ -93,6 +96,7 @@ struct load_details
,oenum_asset_charge_type asset_charge_type
,bool NeedMidpointRates
,round_to<double> const& round_interest_rate
+ ,round_to<double> const& round_minutiae
,std::vector<double> const& VectorExtraCompLoad
,std::vector<double> const& VectorExtraAssetComp
,std::vector<double> const& VectorExtraPolFee
@@ -110,6 +114,7 @@ struct load_details
,asset_charge_type_ {asset_charge_type}
,NeedMidpointRates_ {NeedMidpointRates}
,round_interest_rate_ {round_interest_rate}
+ ,round_minutiae_ {round_minutiae}
,VectorExtraCompLoad_ {VectorExtraCompLoad}
,VectorExtraAssetComp_ {VectorExtraAssetComp}
,VectorExtraPolFee_ {VectorExtraPolFee}
@@ -128,6 +133,7 @@ struct load_details
oenum_asset_charge_type asset_charge_type_;
bool NeedMidpointRates_;
round_to<double> const& round_interest_rate_;
+ round_to<double> const& round_minutiae_;
std::vector<double> const& VectorExtraCompLoad_;
std::vector<double> const& VectorExtraAssetComp_;
std::vector<double> const& VectorExtraPolFee_;
diff --git a/loads_test.cpp b/loads_test.cpp
index b615aa7..329f286 100644
--- a/loads_test.cpp
+++ b/loads_test.cpp
@@ -95,7 +95,7 @@ void LoadsTest::Reinitialize()
loads_.target_sales_load_ [mce_gen_guar] = std::vector<double>(length,
0.30000);
loads_.excess_sales_load_ [mce_gen_guar] = std::vector<double>(length,
0.15000);
- loads_.monthly_policy_fee_ [mce_gen_curr] = std::vector<double>(length,
5.00000);
+ loads_.monthly_policy_fee_ [mce_gen_curr] = std::vector<double>(length,
5.25000);
loads_.annual_policy_fee_ [mce_gen_curr] = std::vector<double>(length,
1.00000);
loads_.specified_amount_load_[mce_gen_curr] = std::vector<double>(length,
0.00002);
loads_.separate_account_load_[mce_gen_curr] = std::vector<double>(length,
0.00110);
@@ -158,7 +158,7 @@ void LoadsTest::TestCalculations(char const* file, int line)
{
INVOKE_BOOST_TEST(materially_equal(0.500000,
loads_.refundable_sales_load_proportion()[0]), file, line);
- INVOKE_BOOST_TEST(materially_equal(6.800000, loads_.monthly_policy_fee
(mce_gen_mdpt)[0]), file, line);
+ INVOKE_BOOST_TEST(materially_equal(6.920000, loads_.monthly_policy_fee
(mce_gen_mdpt)[0]), file, line);
INVOKE_BOOST_TEST(materially_equal(1.500000, loads_.annual_policy_fee
(mce_gen_mdpt)[0]), file, line);
INVOKE_BOOST_TEST(materially_equal(0.000625, loads_.specified_amount_load
(mce_gen_mdpt)[0]), file, line);
// 12 bp and 19 bp, both converted to monthly, then added together.
@@ -192,6 +192,7 @@ void LoadsTest::TestCalculations(char const* file, int line)
int test_main(int, char*[])
{
round_to<double> round_interest_rate(0, r_not_at_all);
+ round_to<double> round_minutiae (2, r_to_nearest);
std::vector<double> extra_comp_load (length, 0.0170);
std::vector<double> extra_asset_comp (length, 0.0019);
std::vector<double> extra_policy_fee (length, 0.6000);
@@ -210,6 +211,7 @@ int test_main(int, char*[])
,oe_asset_charge_load // asset_charge_type_
,true // NeedMidpointRates_
,round_interest_rate // round_interest_rate_
+ ,round_minutiae // round_minutiae_
,extra_comp_load // VectorExtraCompLoad_
,extra_asset_comp // VectorExtraAssetComp_
,extra_policy_fee // VectorExtraPolFee_