[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8bca370 2/2: Fix defect introduced 20050114T1
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8bca370 2/2: Fix defect introduced 20050114T1947Z: unit conversion horror [382] |
Date: |
Wed, 30 May 2018 22:21:03 -0400 (EDT) |
branch: master
commit 8bca370546b3450b38a62837c974609c4709e08c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Fix defect introduced 20050114T1947Z: unit conversion horror [382]
Input field 'ExtraCompensationOnAssets' represents what its name
suggests, but in what units? After this commit, it's always a pure
number: e.g., '1' means one, unity, 100%, 10000bp. So is its
corresponding (gratuitously renamed) output variable
'AddonCompOnAssets'.
Before this commit, however, those two entities meant different things
depending on the value of 'DB_AssetChargeType':
oe_asset_charge_spread: pure numbers
oe_asset_charge_load: basis points ('bp': hundredths of a percent)
Thus, one particular system-test output ('.test') had:
AddonCompOnAssets
25
...
AddonCompOnPremium
0.00610000000000000038719
which meant extra loads of 25 bp on assets and 61 bp on premium,
because the product happened to use oe_asset_charge_load.
The (proprietary) system-test files have been amended accordingly.
Although this defect was introduced 20050114T1947Z into CVS, it comes
from an original file predating the lmi epoch.
---
input_realization.cpp | 5 ++---
loads.cpp | 3 +--
loads_test.cpp | 10 +++++-----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/input_realization.cpp b/input_realization.cpp
index 465b451..affce59 100644
--- a/input_realization.cpp
+++ b/input_realization.cpp
@@ -304,10 +304,9 @@ std::string Input::RealizeExtraCompensationOnAssets()
// numeric-value: numeric-literal %%
// then we might say "100%" here.
- // TODO ?? Defect: currently entered in basis points.
- if(10000.0 < highest)
+ if(1.0 < highest)
{
- return "Add-on compensation cannot exceed 10000 basis points.";
+ return "Add-on compensation cannot exceed 1 (meaning 100% of assets).";
}
return "";
diff --git a/loads.cpp b/loads.cpp
index b9392f2..56a1e84 100644
--- a/loads.cpp
+++ b/loads.cpp
@@ -165,13 +165,12 @@ void Loads::Calculate(load_details const& details)
// elsewhere as an interest spread.
if(oe_asset_charge_load == details.asset_charge_type_)
{
- static long double const units_per_bp = 1.0L / 10000.0L;
std::vector<double> extra_asset_comp(details.length_);
assign
(extra_asset_comp
,apply_unary
(i_upper_12_over_12_from_i<double>()
- ,details.VectorExtraAssetComp_ * units_per_bp
+ ,details.VectorExtraAssetComp_
)
);
diff --git a/loads_test.cpp b/loads_test.cpp
index 51e883f..2ba4248 100644
--- a/loads_test.cpp
+++ b/loads_test.cpp
@@ -193,11 +193,11 @@ void LoadsTest::TestCalculations(char const* file, int
line)
int test_main(int, char*[])
{
round_to<double> round_interest_rate(0, r_not_at_all);
- std::vector<double> extra_comp_load (length, 0.0170);
- std::vector<double> extra_asset_comp (length, 19.0000); // In bp, sadly.
- std::vector<double> extra_policy_fee (length, 0.6000);
- std::vector<double> guar_specamt_load(length, 0.0007);
- std::vector<double> curr_specamt_load(length, 0.0005);
+ 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);
+ std::vector<double> guar_specamt_load(length, 0.0007);
+ std::vector<double> curr_specamt_load(length, 0.0005);
load_details details
(length // length_