[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8667bda 2/6: Add a rounding rule for minutiae
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8667bda 2/6: Add a rounding rule for minutiae |
Date: |
Wed, 12 Aug 2020 18:47:59 -0400 (EDT) |
branch: master
commit 8667bda49091ec65b65bc7af0c6cf948c858f9e6
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Add a rounding rule for minutiae
Many intermediate values probably ought to be rounded, e.g.:
specified-amount load
rider charges
account value (both general- and separate-account components)
even though product specifications generally don't specify rounding at
this level of detail.
Consistently rounding such intermediate values allows them to be
represented as integral numbers of cents, which reduces the likelihood
of gratuitous regressions.
(Premium loads, e.g.:
DAC-tax and premium-tax loads
are already calculated as
total_load = round(sum_of_rates * premium)
with rounding applied only to the result; that's reasonable, and
there's no need to round each particular component separately--the
present rounding is enough to prevent this account-value decrement
from assuming a value that is not an integral number of cents.)
Only a single rule seems necessary for rounding such minutiae. By
default, it rounds to the nearest cent, but any other rule can be
specified for any product, and choosing the 'r_not_at_all' rounding
style prevents minutiae from being rounded at all.
This new rounding rule, like the others, can be modified in the GUI
product editor, making it convenient to investigate its effect (once
it has actually been used in the monthiversary calculations).
---
basic_values.hpp | 2 ++
basicvalues.cpp | 1 +
ihs_basicval.cpp | 1 +
rounding_document.cpp | 1 +
rounding_rules.cpp | 2 ++
rounding_rules.hpp | 1 +
rounding_view.xrc | 12 ++++++++++++
7 files changed, 20 insertions(+)
diff --git a/basic_values.hpp b/basic_values.hpp
index 9facbf6..c90110f 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -190,6 +190,7 @@ class LMI_SO BasicValues
round_to<double> const& round_max_specamt () const {return
round_max_specamt_ ;}
round_to<double> const& round_min_premium () const {return
round_min_premium_ ;}
round_to<double> const& round_max_premium () const {return
round_max_premium_ ;}
+ round_to<double> const& round_minutiae () const {return
round_minutiae_ ;}
protected:
double GetModalMinPrem
@@ -450,6 +451,7 @@ class LMI_SO BasicValues
round_to<double> round_max_specamt_ ;
round_to<double> round_min_premium_ ;
round_to<double> round_max_premium_ ;
+ round_to<double> round_minutiae_ ;
};
inline int BasicValues::GetLength() const
diff --git a/basicvalues.cpp b/basicvalues.cpp
index f30fbcf..d93a0e0 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -79,6 +79,7 @@ BasicValues::BasicValues(Input const& input)
,round_max_specamt_ {0, r_downward }
,round_min_premium_ {2, r_upward }
,round_max_premium_ {2, r_downward }
+ ,round_minutiae_ {2, r_to_nearest}
{
Init();
}
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 29ae765..e473018 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -794,6 +794,7 @@ void BasicValues::SetRoundingFunctors()
set_rounding_rule(round_max_specamt_ ,
RoundingRules_->datum("RoundMaxSpecamt" ));
set_rounding_rule(round_min_premium_ ,
RoundingRules_->datum("RoundMinPrem" ));
set_rounding_rule(round_max_premium_ ,
RoundingRules_->datum("RoundMaxPrem" ));
+ set_rounding_rule(round_minutiae_ ,
RoundingRules_->datum("RoundMinutiae" ));
}
/// Establish maximum survivorship duration.
diff --git a/rounding_document.cpp b/rounding_document.cpp
index 21e4058..d91b3de 100644
--- a/rounding_document.cpp
+++ b/rounding_document.cpp
@@ -58,6 +58,7 @@ RoundingDocument::RoundingDocument()
values_["round_max_specamt" ] = &rounding_rules_.round_max_specamt_
;
values_["round_min_premium" ] = &rounding_rules_.round_min_premium_
;
values_["round_max_premium" ] = &rounding_rules_.round_max_premium_
;
+ values_["round_minutiae" ] = &rounding_rules_.round_minutiae_
;
}
void RoundingDocument::ReadDocument(std::string const& filename)
diff --git a/rounding_rules.cpp b/rounding_rules.cpp
index 02fd647..f8111cd 100644
--- a/rounding_rules.cpp
+++ b/rounding_rules.cpp
@@ -152,6 +152,7 @@ rounding_rules::rounding_rules()
,round_max_specamt_ (0, r_downward , "")
,round_min_premium_ (2, r_upward , "")
,round_max_premium_ (2, r_downward , "")
+ ,round_minutiae_ (2, r_to_nearest, "")
{
ascribe_members();
}
@@ -222,6 +223,7 @@ void rounding_rules::ascribe_members()
ascribe("RoundMaxSpecamt" , &rounding_rules::round_max_specamt_ );
ascribe("RoundMinPrem" , &rounding_rules::round_min_premium_ );
ascribe("RoundMaxPrem" , &rounding_rules::round_max_premium_ );
+ ascribe("RoundMinutiae" , &rounding_rules::round_minutiae_ );
}
/// Backward-compatibility serial number of this class's xml version.
diff --git a/rounding_rules.hpp b/rounding_rules.hpp
index 37b4f43..05240bc 100644
--- a/rounding_rules.hpp
+++ b/rounding_rules.hpp
@@ -151,6 +151,7 @@ class LMI_SO rounding_rules final
rounding_parameters round_max_specamt_ ;
rounding_parameters round_min_premium_ ;
rounding_parameters round_max_premium_ ;
+ rounding_parameters round_minutiae_ ;
};
void LMI_SO load(rounding_rules &, fs::path const&);
diff --git a/rounding_view.xrc b/rounding_view.xrc
index 8d561b0..04b761e 100644
--- a/rounding_view.xrc
+++ b/rounding_view.xrc
@@ -316,6 +316,18 @@
<size>-1,-1</size>
</object>
</object>
+ <object class="sizeritem">
+
<flag>wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</flag>
+ <object class="wxStaticText">
+ <label>Minutiae</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT</flag>
+ <object class="RoundingButtons"
name="round_minutiae">
+ <size>-1,-1</size>
+ </object>
+ </object>
</object>
</object>
</object>
- [lmi-commits] [lmi] master updated (26865ea -> e166864), Greg Chicares, 2020/08/12
- [lmi-commits] [lmi] master 97a7a35 1/6: Improve variable names, Greg Chicares, 2020/08/12
- [lmi-commits] [lmi] master e166864 6/6: Round interest credit to separate account, Greg Chicares, 2020/08/12
- [lmi-commits] [lmi] master 8667bda 2/6: Add a rounding rule for minutiae,
Greg Chicares <=
- [lmi-commits] [lmi] master 363ea40 3/6: Round specified-amount load, Greg Chicares, 2020/08/12
- [lmi-commits] [lmi] master 785e6f4 4/6: Round rider charges, Greg Chicares, 2020/08/12
- [lmi-commits] [lmi] master 7837f36 5/6: Fix defect introduced 20050114T1947Z: function call with no effect, Greg Chicares, 2020/08/12