[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/001 e20dbb2 1/4: Change type of currency var
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/001 e20dbb2 1/4: Change type of currency variables to 'currency' |
Date: |
Sat, 22 Aug 2020 11:37:09 -0400 (EDT) |
branch: valyuta/001
commit e20dbb2a8b165646a48e99d381a8aab9475d24f4
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Change type of currency variables to 'currency'
Attempted to use the 'currency' type for all values that naturally must
hold amounts in integral cents. No doubt some type I and type II errors
have been made. Some choices are perhaps arbitrary: premium load is
calculated as
round(base * Σrates)
, which apparently has some basis in practice; yet rider charges are
treated the same way, which seems odd, especially for WP charges whose
formula includes the charges for some other riders.
'currency' is still typedef'd as double, so this has no effect, yet.
---
account_value.hpp | 421 +++++++++++++++++++++++++++--------------------------
basic_values.hpp | 137 ++++++++---------
death_benefits.hpp | 17 ++-
outlay.hpp | 65 +++++----
4 files changed, 322 insertions(+), 318 deletions(-)
diff --git a/account_value.hpp b/account_value.hpp
index a0a11b7..11dafbc 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -25,6 +25,7 @@
#include "config.hpp"
#include "basic_values.hpp"
+#include "currency.hpp"
#include "oecumenic_enumerations.hpp"
#include "so_attributes.hpp"
@@ -59,34 +60,34 @@ class LMI_SO AccountValue final
AccountValue(AccountValue&&) = default;
~AccountValue() override = default;
- double RunAV ();
+ currency RunAV();
void SetDebugFilename (std::string const&);
void SolveSetPmts // Antediluvian.
- (double a_Pmt
- ,int ThatSolveBegYear
- ,int ThatSolveEndYear
+ (currency a_Pmt
+ ,int ThatSolveBegYear
+ ,int ThatSolveEndYear
);
void SolveSetSpecAmt // Antediluvian.
- (double a_Bft
- ,int ThatSolveBegYear
- ,int ThatSolveEndYear
+ (currency a_Bft
+ ,int ThatSolveBegYear
+ ,int ThatSolveEndYear
);
void SolveSetLoans // Antediluvian.
- (double a_Loan
- ,int ThatSolveBegYear
- ,int ThatSolveEndYear
+ (currency a_Loan
+ ,int ThatSolveBegYear
+ ,int ThatSolveEndYear
);
void SolveSetWDs // Antediluvian.
- (double a_WD
- ,int ThatSolveBegYear
- ,int ThatSolveEndYear
+ (currency a_WD
+ ,int ThatSolveBegYear
+ ,int ThatSolveEndYear
);
void SolveSetLoanThenWD // Antediluvian.
- (double a_Amt
- ,int ThatSolveBegYear
- ,int ThatSolveEndYear
+ (currency a_Amt
+ ,int ThatSolveBegYear
+ ,int ThatSolveEndYear
);
std::shared_ptr<Ledger const> ledger_from_av() const;
@@ -100,20 +101,20 @@ class LMI_SO AccountValue final
int GetLength () const;
- double InforceLivesBoy () const;
- double InforceLivesEoy () const;
- double GetSepAcctAssetsInforce () const;
+ double InforceLivesBoy () const;
+ double InforceLivesEoy () const;
+ currency GetSepAcctAssetsInforce () const;
- void process_payment (double);
- void IncrementAVProportionally(double);
- void IncrementAVPreferentially(double, oenum_increment_account_preference);
- void process_deduction (double);
- void process_distribution (double);
- void DecrementAVProportionally(double);
- void DecrementAVProgressively (double, oenum_increment_account_preference);
+ void process_payment (currency);
+ void IncrementAVProportionally(currency);
+ void IncrementAVPreferentially(currency,
oenum_increment_account_preference);
+ void process_deduction (currency);
+ void process_distribution (currency);
+ void DecrementAVProportionally(currency);
+ void DecrementAVProgressively (currency,
oenum_increment_account_preference);
- double TotalAccountValue() const;
- double CashValueFor7702() const;
+ currency TotalAccountValue() const;
+ currency CashValueFor7702() const;
// We're not yet entirely sure how to handle ledger values. Right now,
// we have pointers to a Ledger and also to its variant and invariant
@@ -125,9 +126,9 @@ class LMI_SO AccountValue final
LedgerInvariant& InvariantValues();
LedgerVariant & VariantValues ();
- double RunOneCell (mcenum_run_basis);
- double RunOneBasis (mcenum_run_basis);
- double RunAllApplicableBases ();
+ currency RunOneCell (mcenum_run_basis);
+ currency RunOneBasis (mcenum_run_basis);
+ currency RunAllApplicableBases ();
void InitializeLife (mcenum_run_basis);
void FinalizeLife (mcenum_run_basis);
void FinalizeLifeAllBases ();
@@ -147,11 +148,11 @@ class LMI_SO AccountValue final
,int a_InforceMonth = 0
);
- void SolveSetSpecAmt (double a_CandidateValue);
- void SolveSetEePrem (double a_CandidateValue);
- void SolveSetErPrem (double a_CandidateValue);
- void SolveSetLoan (double a_CandidateValue);
- void SolveSetWD (double a_CandidateValue);
+ void SolveSetSpecAmt (currency a_CandidateValue);
+ void SolveSetEePrem (currency a_CandidateValue);
+ void SolveSetErPrem (currency a_CandidateValue);
+ void SolveSetLoan (currency a_CandidateValue);
+ void SolveSetWD (currency a_CandidateValue);
void DebugPrint ();
@@ -172,59 +173,59 @@ class LMI_SO AccountValue final
// to the point where interest is credited.
// Process monthly transactions up to but excluding interest credit
- double IncrementBOM
+ currency IncrementBOM
(int year
,int month
,double a_case_k_factor
);
// Credit interest and process all subsequent monthly transactions
void IncrementEOM
- (int year
- ,int month
- ,double assets_post_bom
- ,double cum_pmts_post_bom
+ (int year
+ ,int month
+ ,currency assets_post_bom
+ ,currency cum_pmts_post_bom
);
void IncrementEOY(int year);
bool PrecedesInforceDuration(int year, int month);
- double Solve(); // Antediluvian.
- double Solve
+ currency Solve(); // Antediluvian.
+ currency Solve
(mcenum_solve_type a_SolveType
,int a_SolveBeginYear
,int a_SolveEndYear
,mcenum_solve_target a_SolveTarget
- ,double a_SolveTargetCsv
+ ,currency a_SolveTargetCsv
,int a_SolveTargetYear
,mcenum_gen_basis a_SolveGenBasis
,mcenum_sep_basis a_SolveSepBasis
);
- double SolveTest (double a_CandidateValue);
+ currency SolveTest (currency a_CandidateValue);
- double SolveGuarPremium ();
+ currency SolveGuarPremium ();
double GetPartMortQ (int year) const;
void PerformSpecAmtStrategy();
void PerformSupplAmtStrategy();
- double CalculateSpecAmtFromStrategy
+ currency CalculateSpecAmtFromStrategy
(int actual_year
,int reference_year
- ,double explicit_value
+ ,currency explicit_value
,mcenum_sa_strategy strategy
) const;
- void PerformPmtStrategy(double* a_Pmt); // Antediluvian.
- double PerformEePmtStrategy () const;
- double PerformErPmtStrategy () const;
- double DoPerformPmtStrategy
+ void PerformPmtStrategy(currency* a_Pmt); // Antediluvian.
+ currency PerformEePmtStrategy () const;
+ currency PerformErPmtStrategy () const;
+ currency DoPerformPmtStrategy
(mcenum_solve_type a_SolveForWhichPrem
,mcenum_mode a_CurrentMode
,mcenum_mode a_InitialMode
,double a_TblMult
- ,std::vector<double> const& a_PmtVector
+ ,std::vector<currency> const& a_PmtVector
,std::vector<mcenum_pmt_strategy> const& a_StrategyVector
) const;
@@ -235,15 +236,15 @@ class LMI_SO AccountValue final
void TxTestGPT ();
void TxPmt(); // Antediluvian.
void TxAscertainDesiredPayment ();
- void TxLimitPayment (double a_maxpmt);
+ void TxLimitPayment (currency a_maxpmt);
void TxRecognizePaymentFor7702A
- (double a_pmt
- ,bool a_this_payment_is_unnecessary
+ (currency a_pmt
+ ,bool a_this_payment_is_unnecessary
);
- void TxAcceptPayment (double payment);
+ void TxAcceptPayment (currency payment);
double GetPremLoad
- (double a_pmt
- ,double a_portion_exempt_from_premium_tax
+ (currency a_pmt
+ ,double a_portion_exempt_from_premium_tax
);
void TxLoanRepay ();
@@ -269,31 +270,31 @@ class LMI_SO AccountValue final
// Reflects optional daily interest accounting.
double ActualMonthlyRate (double monthly_rate) const;
- double InterestCredited
- (double principal
+ currency InterestCredited
+ (double currency
,double monthly_rate
) const;
bool IsModalPmtDate (mcenum_mode) const;
bool IsModalPmtDate (); // Antediluvian.
int MonthsToNextModalPmtDate() const;
- double anticipated_deduction (mcenum_anticipated_deduction);
+ currency anticipated_deduction (mcenum_anticipated_deduction);
- double minimum_specified_amount(bool issuing_now, bool term_rider) const;
- void ChangeSpecAmtBy (double delta);
- void ChangeSupplAmtBy (double delta);
+ currency minimum_specified_amount(bool issuing_now, bool term_rider) const;
+ void ChangeSpecAmtBy (currency delta);
+ void ChangeSupplAmtBy (currency delta);
- double SurrChg () const;
- double CSVBoost () const;
+ currency SurrChg () const;
+ currency CSVBoost () const;
void set_list_bill_year_and_month();
void set_list_bill_premium();
void SetMaxLoan ();
void SetMaxWD ();
- double GetRefundableSalesLoad () const;
+ currency GetRefundableSalesLoad() const;
- void ApplyDynamicMandE (double assets);
+ void ApplyDynamicMandE (currency assets);
void SetMonthlyDetail(int enumerator, std::string const& s);
void SetMonthlyDetail(int enumerator, double d);
@@ -309,12 +310,12 @@ class LMI_SO AccountValue final
std::ofstream DebugStream;
std::vector<std::string> DebugRecord;
- double PriorAVGenAcct;
- double PriorAVSepAcct;
- double PriorAVRegLn;
- double PriorAVPrfLn;
- double PriorRegLnBal;
- double PriorPrfLnBal;
+ currency PriorAVGenAcct;
+ currency PriorAVSepAcct;
+ currency PriorAVRegLn;
+ currency PriorAVPrfLn;
+ currency PriorRegLnBal;
+ currency PriorPrfLnBal;
// Mode flags.
bool Debugging;
@@ -335,13 +336,13 @@ class LMI_SO AccountValue final
oenum_allocation_method er_premium_allocation_method;
oenum_increment_account_preference er_premium_preferred_account;
- double GuarPremium;
+ currency GuarPremium;
// These data members make Solve() arguments available to SolveTest().
int SolveBeginYear_;
int SolveEndYear_;
mcenum_solve_target SolveTarget_;
- double SolveTargetCsv_;
+ currency SolveTargetCsv_;
int SolveTargetDuration_;
mcenum_gen_basis SolveGenBasis_;
mcenum_sep_basis SolveSepBasis_;
@@ -353,12 +354,12 @@ class LMI_SO AccountValue final
int LapseMonth; // Antediluvian.
int LapseYear; // Antediluvian.
- double External1035Amount;
- double Internal1035Amount;
- double Dumpin;
+ currency External1035Amount;
+ currency Internal1035Amount;
+ currency Dumpin;
- double MlyNoLapsePrem;
- double CumNoLapsePrem;
+ currency MlyNoLapsePrem;
+ currency CumNoLapsePrem;
bool NoLapseActive;
// Solves need to know when a no-lapse guarantee is active.
@@ -366,63 +367,63 @@ class LMI_SO AccountValue final
std::vector<int> YearlyNoLapseActive;
// Ullage is any positive excess of amount requested over amount available.
- std::vector<double> loan_ullage_;
- std::vector<double> withdrawal_ullage_;
+ std::vector<currency> loan_ullage_;
+ std::vector<currency> withdrawal_ullage_;
- double CumPmts;
- double TaxBasis;
+ currency CumPmts;
+ currency TaxBasis;
// This supports solves for tax basis. Eventually it should be
// moved into the invariant-ledger class.
- std::vector<double> YearlyTaxBasis;
+ std::vector<currency> YearlyTaxBasis;
// Ee- and Er-GrossPmts aren't used directly in the AV calculations.
// They must be kept separate for ledger output, and also for
// tax basis calculations (when we fix that).
- std::vector<double> GrossPmts;
- std::vector<double> EeGrossPmts;
- std::vector<double> ErGrossPmts;
- std::vector<double> NetPmts;
+ std::vector<currency> GrossPmts;
+ std::vector<currency> EeGrossPmts;
+ std::vector<currency> ErGrossPmts;
+ std::vector<currency> NetPmts;
// Reproposal input.
- int InforceYear;
- int InforceMonth;
- double InforceAVGenAcct;
- double InforceAVSepAcct;
- double InforceAVRegLn;
- double InforceAVPrfLn;
- double InforceRegLnBal;
- double InforcePrfLnBal;
- double InforceCumNoLapsePrem;
- double InforceBasis;
- double InforceCumPmts;
- double InforceTaxBasis;
- double InforceLoanBalance;
+ int InforceYear;
+ int InforceMonth;
+ currency InforceAVGenAcct;
+ currency InforceAVSepAcct;
+ currency InforceAVRegLn;
+ currency InforceAVPrfLn;
+ currency InforceRegLnBal;
+ currency InforcePrfLnBal;
+ currency InforceCumNoLapsePrem;
+ currency InforceBasis;
+ currency InforceCumPmts;
+ currency InforceTaxBasis;
+ currency InforceLoanBalance;
// Intermediate values.
- int Year;
- int Month;
- int MonthsSinceIssue;
- bool daily_interest_accounting;
- int days_in_policy_month;
- int days_in_policy_year;
- double AVGenAcct;
- double AVSepAcct;
- double SepAcctValueAfterDeduction;
- double GenAcctPaymentAllocation;
- double SepAcctPaymentAllocation;
- double NAAR;
- double CoiCharge;
- double RiderCharges;
- double NetCoiCharge;
- double SpecAmtLoadBase;
- double DacTaxRsv;
-
- double AVUnloaned; // Antediluvian.
-
- double NetMaxNecessaryPremium;
- double GrossMaxNecessaryPremium;
- double NecessaryPremium;
- double UnnecessaryPremium;
+ int Year;
+ int Month;
+ int MonthsSinceIssue;
+ bool daily_interest_accounting;
+ int days_in_policy_month;
+ int days_in_policy_year;
+ currency AVGenAcct;
+ currency AVSepAcct;
+ currency SepAcctValueAfterDeduction;
+ double GenAcctPaymentAllocation;
+ double SepAcctPaymentAllocation;
+ double NAAR;
+ currency CoiCharge;
+ currency RiderCharges;
+ currency NetCoiCharge;
+ currency SpecAmtLoadBase;
+ double DacTaxRsv;
+
+ currency AVUnloaned; // Antediluvian.
+
+ currency NetMaxNecessaryPremium;
+ currency GrossMaxNecessaryPremium;
+ currency NecessaryPremium;
+ currency UnnecessaryPremium;
// 7702A CVAT deemed cash value.
double Dcv;
@@ -434,49 +435,49 @@ class LMI_SO AccountValue final
// For other riders like AD&D, charge for DCV = charge otherwise.
// Honeymoon provision.
- bool HoneymoonActive;
- double HoneymoonValue;
+ bool HoneymoonActive;
+ currency HoneymoonValue;
// 7702 GPT
- double GptForceout;
- double YearsTotalGptForceout;
+ currency GptForceout;
+ currency YearsTotalGptForceout;
// Intermediate values within annual or monthly loop only.
- double pmt; // Antediluvian.
+ currency pmt; // Antediluvian.
mcenum_mode pmt_mode; // Antediluvian.
int ModeIndex; // Antediluvian.
- double GenAcctIntCred;
- double SepAcctIntCred;
- double RegLnIntCred;
- double PrfLnIntCred;
- double AVRegLn;
- double AVPrfLn;
- double RegLnBal;
- double PrfLnBal;
- double MaxLoan;
- double UnusedTargetPrem;
- double AnnualTargetPrem;
- double MaxWD;
- double GrossWD;
- double NetWD;
- double CumWD;
-
- double wd; // Antediluvian.
+ currency GenAcctIntCred;
+ currency SepAcctIntCred;
+ currency RegLnIntCred;
+ currency PrfLnIntCred;
+ currency AVRegLn;
+ currency AVPrfLn;
+ currency RegLnBal;
+ currency PrfLnBal;
+ currency MaxLoan;
+ currency UnusedTargetPrem;
+ currency AnnualTargetPrem;
+ currency MaxWD;
+ currency GrossWD;
+ currency NetWD;
+ currency CumWD;
+
+ currency wd; // Antediluvian.
double mlyguarv; // Antediluvian.
// For GPT: SA, DB, and DBOpt before the day's transactions are applied.
- double OldSA;
- double OldDB;
+ currency OldSA;
+ currency OldDB;
mcenum_dbopt OldDBOpt;
// Permanent invariants are in class BasicValues; these are
// annual invariants.
double YearsCorridorFactor;
mcenum_dbopt YearsDBOpt;
- double YearsSpecAmt;
- double YearsAnnualPolicyFee;
- double YearsMonthlyPolicyFee;
+ currency YearsSpecAmt;
+ currency YearsAnnualPolicyFee;
+ currency YearsMonthlyPolicyFee;
double YearsGenAcctIntRate;
double YearsSepAcctIntRate;
@@ -512,8 +513,8 @@ class LMI_SO AccountValue final
double YearsSalesLoadRefundRate;
double YearsDacTaxLoadRate;
- double MonthsPolicyFees;
- double SpecAmtLoad;
+ currency MonthsPolicyFees;
+ currency SpecAmtLoad;
double premium_load_;
double sales_load_;
double premium_tax_load_;
@@ -524,9 +525,9 @@ class LMI_SO AccountValue final
// stored at the proper moment, where they're constrained to be
// nonnegative. Stratified loads happen to be used only for the
// separate account.
- double AssetsPostBom;
- double CumPmtsPostBom;
- double SepAcctLoad;
+ currency AssetsPostBom;
+ currency CumPmtsPostBom;
+ currency SepAcctLoad;
double case_k_factor;
double ActualCoiRate;
@@ -537,46 +538,46 @@ class LMI_SO AccountValue final
int list_bill_year_ {methuselah};
int list_bill_month_ {13};
- bool TermCanLapse;
- bool TermRiderActive;
- double ActualSpecAmt;
- double TermSpecAmt;
- double TermDB;
- double DB7702A;
- double DBIgnoringCorr;
- double DBReflectingCorr;
-
- double deathbft; // Antediluvian.
- bool haswp; // Antediluvian.
- bool hasadb; // Antediluvian.
-
- double ActualLoan;
- double RequestedLoan;
- double RequestedWD;
-
- double AdbCharge;
- double SpouseRiderCharge;
- double ChildRiderCharge;
- double WpCharge;
- double TermCharge;
-
- double MlyDed;
- double mlydedtonextmodalpmtdate; // Antediluvian.
-
- double YearsTotalCoiCharge;
- double YearsTotalRiderCharges;
- double YearsAVRelOnDeath;
- double YearsLoanRepaidOnDeath;
- double YearsGrossClaims;
- double YearsDeathProceeds;
- double YearsNetClaims;
- double YearsTotalNetIntCredited;
- double YearsTotalGrossIntCredited;
- double YearsTotalLoanIntAccrued;
- double YearsTotalPolicyFee;
- double YearsTotalDacTaxLoad;
- double YearsTotalSpecAmtLoad;
- double YearsTotalSepAcctLoad;
+ bool TermCanLapse;
+ bool TermRiderActive;
+ currency ActualSpecAmt;
+ currency TermSpecAmt;
+ currency TermDB;
+ currency DB7702A;
+ currency DBIgnoringCorr;
+ currency DBReflectingCorr;
+
+ currency deathbft; // Antediluvian.
+ bool haswp; // Antediluvian.
+ bool hasadb; // Antediluvian.
+
+ currency ActualLoan;
+ currency RequestedLoan;
+ currency RequestedWD;
+
+ currency AdbCharge;
+ currency SpouseRiderCharge;
+ currency ChildRiderCharge;
+ currency WpCharge;
+ currency TermCharge;
+
+ currency MlyDed;
+ currency mlydedtonextmodalpmtdate; // Antediluvian.
+
+ currency YearsTotalCoiCharge;
+ currency YearsTotalRiderCharges;
+ currency YearsAVRelOnDeath;
+ currency YearsLoanRepaidOnDeath;
+ currency YearsGrossClaims;
+ currency YearsDeathProceeds;
+ currency YearsNetClaims;
+ double YearsTotalNetIntCredited;
+ double YearsTotalGrossIntCredited;
+ double YearsTotalLoanIntAccrued;
+ currency YearsTotalPolicyFee;
+ double YearsTotalDacTaxLoad;
+ currency YearsTotalSpecAmtLoad;
+ currency YearsTotalSepAcctLoad;
std::vector<double> partial_mortality_q;
@@ -587,31 +588,31 @@ class LMI_SO AccountValue final
double NextYearsProjectedCoiCharge;
double YearsTotalNetCoiCharge;
- double CumulativeSalesLoad;
+ currency CumulativeSalesLoad;
// Illustrated outlay must be the same for current, guaranteed,
// and all other bases. Outlay components are set on whichever
// basis governs, usually current, then stored for use with all
// other bases.
- std::vector<double> OverridingPmts; // Antediluvian.
+ std::vector<currency> OverridingPmts; // Antediluvian.
- std::vector<double> OverridingEePmts;
- std::vector<double> OverridingErPmts;
+ std::vector<currency> OverridingEePmts;
+ std::vector<currency> OverridingErPmts;
// We need no 'OverridingDumpin' because we simply treat dumpin as
// employee premium.
- double OverridingExternal1035Amount;
- double OverridingInternal1035Amount;
+ currency OverridingExternal1035Amount;
+ currency OverridingInternal1035Amount;
- std::vector<double> OverridingLoan;
- std::vector<double> OverridingWD;
+ std::vector<currency> OverridingLoan;
+ std::vector<currency> OverridingWD;
- std::vector<double> SurrChg_; // Of uncertain utility.
+ std::vector<currency> SurrChg_; // Of uncertain utility.
};
//============================================================================
-inline double AccountValue::TotalAccountValue() const
+inline currency AccountValue::TotalAccountValue() const
{
return AVGenAcct + AVSepAcct + AVRegLn + AVPrfLn;
}
diff --git a/basic_values.hpp b/basic_values.hpp
index 1afa805..0048256 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -25,6 +25,7 @@
#include "config.hpp"
#include "actuarial_table.hpp" // e_actuarial_table_method
+#include "currency.hpp"
#include "database.hpp"
#include "dbnames.hpp" // e_database_key
#include "mc_enum_type_enums.hpp"
@@ -129,7 +130,7 @@ class LMI_SO BasicValues
product_data const& product () const {return product_;}
product_database const& database() const {return database_;}
- double GetAnnualTgtPrem(int a_year, double a_specamt) const;
+ currency GetAnnualTgtPrem(int a_year, currency a_specamt) const;
std::vector<double> const& GetCorridorFactor() const;
std::vector<double> const& SpreadFor7702() const;
@@ -193,89 +194,89 @@ class LMI_SO BasicValues
round_to<double> const& round_minutiae () const {return
round_minutiae_ ;}
protected:
- double GetModalMinPrem
+ currency GetModalMinPrem
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalTgtPrem
+ currency GetModalTgtPrem
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalPremMaxNonMec
+ currency GetModalPremMaxNonMec
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalPremMinFromTable
+ currency GetModalPremMinFromTable
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalPremTgtFromTable
+ currency GetModalPremTgtFromTable
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalPremProxyTable
+ currency GetModalPremProxyTable
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
,double a_table_multiplier
) const;
- double GetModalPremCorridor
+ currency GetModalPremCorridor
(int a_year
,mcenum_mode a_mode
- ,double a_specamt
+ ,currency a_specamt
) const;
- double GetModalPremGLP
+ currency GetModalPremGLP
(int a_duration
,mcenum_mode a_mode
- ,double a_bft_amt
- ,double a_specamt
+ ,currency a_bft_amt
+ ,currency a_specamt
) const;
- double GetModalPremGSP
+ currency GetModalPremGSP
(int a_duration
,mcenum_mode a_mode
- ,double a_bft_amt
- ,double a_specamt
+ ,currency a_bft_amt
+ ,currency a_specamt
) const;
- std::pair<double,double> GetModalPremMlyDedEx
+ std::pair<currency,currency> GetModalPremMlyDedEx
(int year
,mcenum_mode mode
- ,double specamt
- ,double termamt
+ ,currency specamt
+ ,currency termamt
) const;
- double GetListBillPremMlyDed
+ currency GetListBillPremMlyDed
(int year
,mcenum_mode mode
- ,double specamt
+ ,currency specamt
) const;
- std::pair<double,double> GetListBillPremMlyDedEx
+ std::pair<currency,currency> GetListBillPremMlyDedEx
(int year
,mcenum_mode mode
- ,double specamt
- ,double termamt
+ ,currency specamt
+ ,currency termamt
) const;
- double GetModalSpecAmtMax (double annualized_pmt) const;
- double GetModalSpecAmtTgt (double annualized_pmt) const;
- double GetModalSpecAmtMinNonMec(double annualized_pmt) const;
- double GetModalSpecAmtGLP (double annualized_pmt) const;
- double GetModalSpecAmtGSP (double annualized_pmt) const;
- double GetModalSpecAmtCorridor (double annualized_pmt) const;
- double GetModalSpecAmtSalary (int a_year) const;
+ currency GetModalSpecAmtMax (currency annualized_pmt) const;
+ currency GetModalSpecAmtTgt (currency annualized_pmt) const;
+ currency GetModalSpecAmtMinNonMec(currency annualized_pmt) const;
+ currency GetModalSpecAmtGLP (currency annualized_pmt) const;
+ currency GetModalSpecAmtGSP (currency annualized_pmt) const;
+ currency GetModalSpecAmtCorridor (currency annualized_pmt) const;
+ currency GetModalSpecAmtSalary (int a_year) const;
// Deprecated--used only by the antediluvian branch, which does
// not distinguish ee from er premium.
- double GetModalMaxSpecAmt
+ currency GetModalMaxSpecAmt
(mcenum_mode a_mode
- ,double a_pmt
+ ,currency a_pmt
) const;
// Deprecated--used only by the antediluvian branch, which does
// not distinguish ee from er premium.
- double GetModalTgtSpecAmt
+ currency GetModalTgtSpecAmt
(mcenum_mode a_mode
- ,double a_pmt
+ ,currency a_pmt
) const;
std::vector<double> GetTable
(std::string const& TableFile
@@ -287,7 +288,7 @@ class LMI_SO BasicValues
std::vector<double> const& GetBandedCoiRates
(mcenum_gen_basis rate_basis
- ,double a_specamt
+ ,currency a_specamt
) const;
// TODO ?? A priori, protected data is a defect.
@@ -303,13 +304,13 @@ class LMI_SO BasicValues
mcenum_defn_life_ins DefnLifeIns_;
mcenum_defn_material_change DefnMaterialChange_;
mcenum_dbopt_7702 Effective7702DboRop;
- double MaxNAAR;
+ currency MaxNAAR;
int EndtAge;
- double MinSpecAmt; // Antediluvian.
- double MinIssSpecAmt;
- double MinIssBaseSpecAmt;
- double MinRenlSpecAmt;
- double MinRenlBaseSpecAmt;
+ currency MinSpecAmt; // Antediluvian.
+ currency MinIssSpecAmt;
+ currency MinIssBaseSpecAmt;
+ currency MinRenlSpecAmt;
+ currency MinRenlBaseSpecAmt;
bool NoLapseDboLvlOnly;
bool NoLapseUnratedOnly;
bool OptChgCanIncrSA;
@@ -324,13 +325,13 @@ class LMI_SO BasicValues
int TermForcedConvDur;
bool TermIsDbFor7702;
bool TermIsDbFor7702A;
- double ExpPerKLimit;
+ currency ExpPerKLimit;
oenum_modal_prem_type MinPremType;
oenum_modal_prem_type TgtPremType;
bool TgtPremFixedAtIssue;
- double TgtPremMonthlyPolFee;
- double CurrCoiTable0Limit;
- double CurrCoiTable1Limit;
+ currency TgtPremMonthlyPolFee;
+ currency CurrCoiTable0Limit;
+ currency CurrCoiTable1Limit;
e_actuarial_table_method CoiInforceReentry;
mcenum_anticipated_deduction MaxWDDed_;
double MaxWdGenAcctValMult;
@@ -348,11 +349,11 @@ class LMI_SO BasicValues
bool SurrChgOnDecr;
std::vector<double> FreeWDProportion;
- double AdbLimit;
- double WpLimit;
- double SpecAmtLoadLimit;
- double MinWD;
- double WDFee;
+ currency AdbLimit;
+ currency WpLimit;
+ currency SpecAmtLoadLimit;
+ currency MinWD;
+ currency WDFee;
double WDFeeRate;
bool AllowChangeToDBO2;
@@ -374,7 +375,7 @@ class LMI_SO BasicValues
std::vector<double> MinPremIntSpread_;
- std::vector<double> TieredMEBands;
+ std::vector<currency> TieredMEBands;
std::vector<double> TieredMECharges;
private:
@@ -382,21 +383,21 @@ class LMI_SO BasicValues
BasicValues& operator=(BasicValues const&) = delete;
double mly_ded_discount_factor(int year, mcenum_mode mode) const;
- std::pair<double,double> approx_mly_ded
- (int year
- ,double specamt
+ std::pair<currency,currency> approx_mly_ded
+ (int year
+ ,currency specamt
) const;
- std::pair<double,double> approx_mly_ded_ex
- (int year
- ,double specamt
- ,double termamt
+ std::pair<currency,currency> approx_mly_ded_ex
+ (int year
+ ,currency specamt
+ ,currency termamt
) const;
- double GetModalPremMlyDed
+ currency GetModalPremMlyDed
(int year
,mcenum_mode mode
- ,double specamt
+ ,currency specamt
) const;
- double GetModalSpecAmtMlyDed(double annualized_pmt, mcenum_mode) const;
+ currency GetModalSpecAmtMlyDed(currency annualized_pmt, mcenum_mode) const;
std::vector<double> GetActuarialTable
(std::string const& TableFile
@@ -423,7 +424,7 @@ class LMI_SO BasicValues
mcenum_state StateOfJurisdiction_;
mcenum_state StateOfDomicile_;
mcenum_state PremiumTaxState_;
- mutable double InitialTargetPremium;
+ mutable currency InitialTargetPremium;
void Init7702();
void Init7702A();
diff --git a/death_benefits.hpp b/death_benefits.hpp
index 06a3fda..6108932 100644
--- a/death_benefits.hpp
+++ b/death_benefits.hpp
@@ -24,6 +24,7 @@
#include "config.hpp"
+#include "currency.hpp"
#include "mc_enum_type_enums.hpp"
#include <vector>
@@ -36,12 +37,12 @@ class death_benefits final
death_benefits(int, yare_input const&);
~death_benefits() = default;
- void set_specamt (double z, int from_year, int to_year);
- void set_supplamt(double z, int from_year, int to_year);
+ void set_specamt (currency z, int from_year, int to_year);
+ void set_supplamt(currency z, int from_year, int to_year);
std::vector<mcenum_dbopt> const& dbopt () const;
- std::vector<double> const& specamt () const;
- std::vector<double> const& supplamt() const;
+ std::vector<currency> const& specamt () const;
+ std::vector<currency> const& supplamt() const;
private:
death_benefits(death_benefits const&) = delete;
@@ -49,8 +50,8 @@ class death_benefits final
int length_;
std::vector<mcenum_dbopt> dbopt_ ;
- std::vector<double> specamt_ ;
- std::vector<double> supplamt_;
+ std::vector<currency> specamt_ ;
+ std::vector<currency> supplamt_;
};
inline std::vector<mcenum_dbopt> const& death_benefits::dbopt() const
@@ -58,12 +59,12 @@ inline std::vector<mcenum_dbopt> const&
death_benefits::dbopt() const
return dbopt_;
}
-inline std::vector<double> const& death_benefits::specamt() const
+inline std::vector<currency> const& death_benefits::specamt() const
{
return specamt_;
}
-inline std::vector<double> const& death_benefits::supplamt() const
+inline std::vector<currency> const& death_benefits::supplamt() const
{
return supplamt_;
}
diff --git a/outlay.hpp b/outlay.hpp
index 66860b0..fcb46eb 100644
--- a/outlay.hpp
+++ b/outlay.hpp
@@ -24,6 +24,7 @@
#include "config.hpp"
+#include "currency.hpp"
#include "mc_enum_type_enums.hpp"
#include <vector>
@@ -38,57 +39,57 @@ class modal_outlay final
explicit modal_outlay(yare_input const&);
~modal_outlay() = default;
- double dumpin () const;
- double external_1035_amount () const;
- double internal_1035_amount () const;
- std::vector<double> const& ee_modal_premiums () const;
+ currency dumpin () const;
+ currency external_1035_amount () const;
+ currency internal_1035_amount () const;
+ std::vector<currency> const& ee_modal_premiums () const;
std::vector<mcenum_mode> const& ee_premium_modes () const;
- std::vector<double> const& er_modal_premiums () const;
+ std::vector<currency> const& er_modal_premiums () const;
std::vector<mcenum_mode> const& er_premium_modes () const;
- std::vector<double> const& new_cash_loans () const;
- std::vector<double> const& withdrawals () const;
+ std::vector<currency> const& new_cash_loans () const;
+ std::vector<currency> const& withdrawals () const;
private:
modal_outlay(modal_outlay const&) = delete;
modal_outlay& operator=(modal_outlay const&) = delete;
// Not yet used, but needed for MEC avoidance.
- void set_external_1035_amount(double z);
- void set_internal_1035_amount(double z);
-
- void set_ee_modal_premiums(double z, int from_year, int to_year);
- void set_er_modal_premiums(double z, int from_year, int to_year);
- void set_er_modal_premiums(std::vector<double> const&);
- void set_new_cash_loans (double z, int from_year, int to_year);
- void set_withdrawals (double z, int from_year, int to_year);
-
- double dumpin_;
- double external_1035_amount_;
- double internal_1035_amount_;
- std::vector<double> ee_modal_premiums_;
+ void set_external_1035_amount(currency z);
+ void set_internal_1035_amount(currency z);
+
+ void set_ee_modal_premiums(currency z, int from_year, int to_year);
+ void set_er_modal_premiums(currency z, int from_year, int to_year);
+ void set_er_modal_premiums(std::vector<currency> const&);
+ void set_new_cash_loans (currency z, int from_year, int to_year);
+ void set_withdrawals (currency z, int from_year, int to_year);
+
+ currency dumpin_;
+ currency external_1035_amount_;
+ currency internal_1035_amount_;
+ std::vector<currency> ee_modal_premiums_;
std::vector<mcenum_mode> ee_premium_modes_;
- std::vector<double> er_modal_premiums_;
+ std::vector<currency> er_modal_premiums_;
std::vector<mcenum_mode> er_premium_modes_;
- std::vector<double> new_cash_loans_;
- std::vector<double> withdrawals_;
+ std::vector<currency> new_cash_loans_;
+ std::vector<currency> withdrawals_;
};
-inline double modal_outlay::dumpin() const
+inline currency modal_outlay::dumpin() const
{
return dumpin_;
}
-inline double modal_outlay::external_1035_amount() const
+inline currency modal_outlay::external_1035_amount() const
{
return external_1035_amount_;
}
-inline double modal_outlay::internal_1035_amount() const
+inline currency modal_outlay::internal_1035_amount() const
{
return internal_1035_amount_;
}
-inline std::vector<double> const& modal_outlay::ee_modal_premiums() const
+inline std::vector<currency> const& modal_outlay::ee_modal_premiums() const
{
return ee_modal_premiums_;
}
@@ -98,7 +99,7 @@ inline std::vector<mcenum_mode> const&
modal_outlay::ee_premium_modes() const
return ee_premium_modes_;
}
-inline std::vector<double> const& modal_outlay::er_modal_premiums() const
+inline std::vector<currency> const& modal_outlay::er_modal_premiums() const
{
return er_modal_premiums_;
}
@@ -108,22 +109,22 @@ inline std::vector<mcenum_mode> const&
modal_outlay::er_premium_modes() const
return er_premium_modes_;
}
-inline std::vector<double> const& modal_outlay::new_cash_loans() const
+inline std::vector<currency> const& modal_outlay::new_cash_loans() const
{
return new_cash_loans_;
}
-inline std::vector<double> const& modal_outlay::withdrawals() const
+inline std::vector<currency> const& modal_outlay::withdrawals() const
{
return withdrawals_;
}
-inline void modal_outlay::set_external_1035_amount(double z)
+inline void modal_outlay::set_external_1035_amount(currency z)
{
external_1035_amount_ = z;
}
-inline void modal_outlay::set_internal_1035_amount(double z)
+inline void modal_outlay::set_internal_1035_amount(currency z)
{
internal_1035_amount_ = z;
}