[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 27bd748 13/15: Write $0.00 as a currency rath
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 27bd748 13/15: Write $0.00 as a currency rather than floating-point constant |
Date: |
Mon, 25 Jan 2021 09:58:07 -0500 (EST) |
branch: master
commit 27bd748085e1e436992085218e522d7697542e47
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Write $0.00 as a currency rather than floating-point constant
---
accountvalue.cpp | 49 ++++++-------
gpt_specamt.cpp | 4 +-
ihs_acctval.cpp | 114 +++++++++++++++---------------
ihs_avmly.cpp | 208 +++++++++++++++++++++++++++----------------------------
ihs_basicval.cpp | 2 +-
5 files changed, 189 insertions(+), 188 deletions(-)
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 1aa44e7..7d4d81a 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -228,13 +228,13 @@ void AccountValue::RunOneCell(mcenum_run_basis TheBasis)
LapseMonth = 0;
LapseYear = 0;
- TaxBasis = 0.0;
+ TaxBasis = C0;
- MaxLoan = 0.0;
- RegLnBal = 0.0;
- PrfLnBal = 0.0;
- AVRegLn = 0.0;
- AVPrfLn = 0.0;
+ MaxLoan = C0;
+ RegLnBal = C0;
+ PrfLnBal = C0;
+ AVRegLn = C0;
+ AVPrfLn = C0;
// 'InforceAVGenAcct' is unloaned only; this branch wasn't
// designed to allow inforce loans.
@@ -323,8 +323,8 @@ void AccountValue::DoYear
YearsCorridorFactor = BasicValues::GetCorridorFactor()[Year];
- GrossPmts .assign(12, 0.0);
- NetPmts .assign(12, 0.0);
+ GrossPmts .assign(12, C0);
+ NetPmts .assign(12, C0);
// IHS !! Strategy here?
@@ -433,7 +433,7 @@ inline int AccountValue::MonthsToNextModalPmtDate() const
// Set specamt according to selected strategy, in every year.
void AccountValue::PerformSpecAmtStrategy()
{
- double SA = 0.0;
+ currency SA = C0;
switch(yare_input_.SpecifiedAmountStrategy[0])
{
case mce_sa_input_scalar:
@@ -514,8 +514,8 @@ void AccountValue::TxOptionChange()
}
// Nothing to do unless AV is positive.
- double AV = AVUnloaned + AVRegLn + AVPrfLn;
- if(AV <= 0.0)
+ currency AV = AVUnloaned + AVRegLn + AVPrfLn;
+ if(AV <= C0)
{
return;
}
@@ -719,7 +719,7 @@ void AccountValue::TxLoanRepay()
}
// Nothing to do if no loan repayment requested.
- if(0.0 <= RequestedLoan)
+ if(C0 <= RequestedLoan)
{
return;
}
@@ -757,7 +757,7 @@ void AccountValue::TxSetDeathBft()
// Option 2: specamt plus AV, or corridor times AV if greater.
// Negative AV doesn't decrease death benefit.
deathbft = std::max
- (ActualSpecAmt + std::max(0.0, AV)
+ (ActualSpecAmt + std::max(C0, AV)
,YearsCorridorFactor * AV
);
break;
@@ -790,7 +790,7 @@ void AccountValue::TxSetCoiCharge()
void AccountValue::TxSetRiderDed()
{
- WpCharge = 0.0;
+ WpCharge = C0;
if(haswp)
{
WpCharge =
@@ -799,9 +799,10 @@ void AccountValue::TxSetRiderDed()
;
}
- AdbCharge = 0.0;
+ AdbCharge = C0;
if(hasadb)
{
+ // IHS !! Icky manifest constant--lmi uses a database entity.
AdbCharge = YearsAdbRate * std::min(500000.0, ActualSpecAmt);
}
}
@@ -821,14 +822,14 @@ void AccountValue::TxCreditInt()
{
// Accrue interest on unloaned and loaned account value separately,
// but do not charge interest on negative account value.
- if(0.0 < AVUnloaned)
+ if(C0 < AVUnloaned)
{
// IHS !! Each interest increment is rounded separately in lmi.
double z = round_interest_credit()(AVUnloaned * YearsGenAcctIntRate);
AVUnloaned += z;
}
// Loaned account value cannot be negative.
- LMI_ASSERT(0.0 <= AVRegLn + AVPrfLn);
+ LMI_ASSERT(C0 <= AVRegLn + AVPrfLn);
}
/// Accrue loan interest, and calculate interest credit on loaned AV.
@@ -836,7 +837,7 @@ void AccountValue::TxCreditInt()
void AccountValue::TxLoanInt()
{
// Nothing to do if there's no loan outstanding.
- if(0.0 == RegLnBal && 0.0 == PrfLnBal)
+ if(C0 == RegLnBal && C0 == PrfLnBal)
{
return;
}
@@ -870,7 +871,7 @@ void AccountValue::TxTakeWD()
}
// Nothing to do if no withdrawal requested.
- if(0.0 == wd)
+ if(C0 == wd)
{
return;
}
@@ -880,7 +881,7 @@ void AccountValue::TxTakeWD()
// Impose minimum amount (if nonzero) on withdrawals.
if(wd < MinWD)
{
- wd = 0.0;
+ wd = C0;
}
// Impose maximum amount.
@@ -959,7 +960,7 @@ void AccountValue::TxTakeLoan()
}
// Nothing to do if no loan requested.
- if(RequestedLoan <= 0.0)
+ if(RequestedLoan <= C0)
{
return;
}
@@ -1012,7 +1013,7 @@ void AccountValue::TxTestLapse()
// Otherwise if AV is negative or if overloaned, then lapse the policy.
else if
(
- (AVUnloaned + AVRegLn + AVPrfLn < 0.0)
+ (AVUnloaned + AVRegLn + AVPrfLn < C0)
|| (MaxLoan < RegLnBal + PrfLnBal)
)
{
@@ -1055,9 +1056,9 @@ double AccountValue::GetCurtateNetCoiChargeInforce() const
double AccountValue::GetProjectedCoiChargeInforce() const
{return 0.0;}
currency AccountValue::GetSepAcctAssetsInforce() const
- {return 0.0;}
+ {return C0;}
currency AccountValue::IncrementBOM(int, int, double)
- {return 0.0;}
+ {return C0;}
void AccountValue::IncrementEOM(int, int, currency, currency)
{return;}
void AccountValue::IncrementEOY(int)
diff --git a/gpt_specamt.cpp b/gpt_specamt.cpp
index d00b77e..44cf063 100644
--- a/gpt_specamt.cpp
+++ b/gpt_specamt.cpp
@@ -92,7 +92,7 @@ class FindSpecAmt
,Premium {a_Premium}
,NetPmtFactorTgt {a_NetPmtFactorTgt}
,NetPmtFactorExc {a_NetPmtFactorExc}
- ,SpecAmt {0.0}
+ ,SpecAmt {C0}
{
}
// CURRENCY !! decimal_root() expects this; but see 'ihs_avsolve.cpp'.
@@ -140,7 +140,7 @@ currency gpt_specamt::CalculateSpecAmt
,double a_NetPmtFactorExc
)
{
- LMI_ASSERT(0.0 != a_Premium);
+ LMI_ASSERT(C0 != a_Premium);
LMI_ASSERT(0.0 != a_NetPmtFactorTgt);
LMI_ASSERT(0.0 != a_NetPmtFactorExc);
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index c69cfb8..5e76fcf 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -114,16 +114,16 @@ AccountValue::AccountValue(Input const& input)
// all be kept together.
LapseMonth = 0; // Antediluvian.
LapseYear = 0; // Antediluvian.
- AVUnloaned = 0.0; // Antediluvian.
- pmt = 0.0; // Antediluvian.
+ AVUnloaned = C0; // Antediluvian.
+ pmt = C0; // Antediluvian.
pmt_mode = mce_annual; // Antediluvian.
ModeIndex = 0; // Antediluvian.
- wd = 0.0; // Antediluvian.
+ wd = C0; // Antediluvian.
mlyguarv = 0.0; // Antediluvian.
- deathbft = 0.0; // Antediluvian.
+ deathbft = C0; // Antediluvian.
haswp = false; // Antediluvian.
hasadb = false; // Antediluvian.
- mlydedtonextmodalpmtdate = 0.0; // Antediluvian.
+ mlydedtonextmodalpmtdate = C0; // Antediluvian.
set_list_bill_year_and_month();
@@ -161,7 +161,7 @@ currency AccountValue::specamt_for_7702(int year) const
{
return
base_specamt(year)
- + (TermIsDbFor7702 ? term_specamt(year) : 0.0)
+ + (TermIsDbFor7702 ? term_specamt(year) : C0)
;
}
@@ -171,7 +171,7 @@ currency AccountValue::specamt_for_7702A(int year) const
{
return
base_specamt(year)
- + (TermIsDbFor7702A ? term_specamt(year) : 0.0)
+ + (TermIsDbFor7702A ? term_specamt(year) : C0)
;
}
@@ -248,7 +248,7 @@ Then run other bases.
// this rather expensive function.
void AccountValue::SetGuarPrem()
{
- GuarPremium = 0.0;
+ GuarPremium = C0;
if(BasicValues::IsSubjectToIllustrationReg())
{
GuarPremium = SolveGuarPremium();
@@ -421,7 +421,7 @@ void AccountValue::InitializeLife(mcenum_run_basis a_Basis)
// TODO ?? TAXATION !! Shouldn't we increase initial SA if contract in
corridor at issue?
OldDB = OldSA;
- SurrChg_.assign(BasicValues::GetLength(), 0.0);
+ SurrChg_.assign(BasicValues::GetLength(), C0);
// TAXATION !! Input::InforceAnnualTargetPremium should be used here.
double annual_target_premium = GetModalTgtPrem
@@ -457,9 +457,9 @@ void AccountValue::InitializeLife(mcenum_run_basis a_Basis)
InvariantValues().InforceIsMec = inforce_is_mec;
bool mec_1035 =
yare_input_.External1035ExchangeFromMec
- && 0.0 != Outlay_->external_1035_amount()
+ && C0 != Outlay_->external_1035_amount()
|| yare_input_.Internal1035ExchangeFromMec
- && 0.0 != Outlay_->internal_1035_amount()
+ && C0 != Outlay_->internal_1035_amount()
;
bool is_already_a_mec = inforce_is_mec || mec_1035;
if(is_already_a_mec)
@@ -553,7 +553,7 @@ void AccountValue::SetInitialValues()
Month = InforceMonth;
CoordinateCounters();
- DB7702A = 0.0; // TODO ?? TAXATION !! This seems
silly.
+ DB7702A = C0; // TODO ?? TAXATION !! This seems silly.
AVRegLn = InforceAVRegLn;
AVPrfLn = InforceAVPrfLn;
@@ -594,28 +594,28 @@ void AccountValue::SetInitialValues()
;
}
- MaxLoan = 0.0;
+ MaxLoan = C0;
- GenAcctIntCred = 0.0;
- SepAcctIntCred = 0.0;
- RegLnIntCred = 0.0;
- PrfLnIntCred = 0.0;
+ GenAcctIntCred = C0;
+ SepAcctIntCred = C0;
+ RegLnIntCred = C0;
+ PrfLnIntCred = C0;
- MaxWD = 0.0;
- GrossWD = 0.0;
- NetWD = 0.0;
+ MaxWD = C0;
+ GrossWD = C0;
+ NetWD = C0;
CumPmts = InforceCumPmts;
TaxBasis = InforceTaxBasis;
- YearlyTaxBasis.assign(BasicValues::GetLength(), 0.0);
- MlyNoLapsePrem = 0.0;
+ YearlyTaxBasis.assign(BasicValues::GetLength(), C0);
+ MlyNoLapsePrem = C0;
CumNoLapsePrem = InforceCumNoLapsePrem;
// Initialize all elements of this vector to 'false'. Then, when
// the no-lapse criteria fail to be met, future values are right.
YearlyNoLapseActive.assign(BasicValues::GetLength(), false);
- loan_ullage_ .assign(BasicValues::GetLength(), 0.0);
- withdrawal_ullage_ .assign(BasicValues::GetLength(), 0.0);
+ loan_ullage_ .assign(BasicValues::GetLength(), C0);
+ withdrawal_ullage_ .assign(BasicValues::GetLength(), C0);
NoLapseActive = true;
if(NoLapseDboLvlOnly && mce_option1 != DeathBfts_->dbopt()[0])
{
@@ -631,7 +631,7 @@ void AccountValue::SetInitialValues()
database().query_into(DB_TermCanLapse , TermCanLapse);
TermRiderActive = true;
- TermDB = 0.0;
+ TermDB = C0;
ItLapsed = false;
@@ -660,10 +660,10 @@ void AccountValue::SetInitialValues()
}
}
- CoiCharge = 0.0;
- RiderCharges = 0.0;
- NetCoiCharge = 0.0;
- MlyDed = 0.0;
+ CoiCharge = C0;
+ RiderCharges = C0;
+ NetCoiCharge = C0;
+ MlyDed = C0;
CumulativeSalesLoad = yare_input_.InforceCumulativeSalesLoad;
database().query_into(DB_ExpRatCoiRetention, CoiRetentionRate);
@@ -719,7 +719,7 @@ currency AccountValue::IncrementBOM
{
// Return value is total assets. After the policy has lapsed or
// matured, there are no assets.
- return 0.0;
+ return C0;
}
// Paranoid check.
@@ -791,8 +791,8 @@ void AccountValue::IncrementEOM
// Save arguments, constraining their values to be nonnegative,
// for calculating banded and tiered quantities.
- AssetsPostBom = std::max(0.0, assets_post_bom );
- CumPmtsPostBom = std::max(0.0, cum_pmts_post_bom);
+ AssetsPostBom = std::max(C0, assets_post_bom );
+ CumPmtsPostBom = std::max(C0, cum_pmts_post_bom);
DoMonthCR();
}
@@ -839,29 +839,29 @@ void AccountValue::InitializeYear()
Irc7702A_->UpdateBOY7702A(Year);
}
- MonthsPolicyFees = 0.0;
- SpecAmtLoad = 0.0;
+ MonthsPolicyFees = C0;
+ SpecAmtLoad = C0;
- AssetsPostBom = 0.0;
- CumPmtsPostBom = 0.0;
- SepAcctLoad = 0.0;
+ AssetsPostBom = C0;
+ CumPmtsPostBom = C0;
+ SepAcctLoad = C0;
- YearsTotalCoiCharge = 0.0;
- YearsTotalRiderCharges = 0.0;
+ YearsTotalCoiCharge = C0;
+ YearsTotalRiderCharges = C0;
YearsAVRelOnDeath = 0.0;
YearsLoanRepaidOnDeath = 0.0;
YearsGrossClaims = 0.0;
YearsDeathProceeds = 0.0;
YearsNetClaims = 0.0;
- YearsTotalNetIntCredited = 0.0;
- YearsTotalGrossIntCredited = 0.0;
- YearsTotalLoanIntAccrued = 0.0;
+ YearsTotalNetIntCredited = C0;
+ YearsTotalGrossIntCredited = C0;
+ YearsTotalLoanIntAccrued = C0;
YearsTotalNetCoiCharge = 0.0;
- YearsTotalPolicyFee = 0.0;
+ YearsTotalPolicyFee = C0;
YearsTotalDacTaxLoad = 0.0;
- YearsTotalSpecAmtLoad = 0.0;
- YearsTotalSepAcctLoad = 0.0;
- YearsTotalGptForceout = 0.0;
+ YearsTotalSpecAmtLoad = C0;
+ YearsTotalSepAcctLoad = C0;
+ YearsTotalGptForceout = C0;
NextYearsProjectedCoiCharge = 0.0;
@@ -872,12 +872,12 @@ void AccountValue::InitializeYear()
// variable in each function might have sufficed, except that this
// quantity is used in the optional monthly detail report. Its
// value depends on the maximum loan, so it cannot be known here.
- ActualLoan = 0.0;
+ ActualLoan = C0;
- GrossPmts .assign(12, 0.0);
- EeGrossPmts .assign(12, 0.0);
- ErGrossPmts .assign(12, 0.0);
- NetPmts .assign(12, 0.0);
+ GrossPmts .assign(12, C0);
+ EeGrossPmts .assign(12, C0);
+ ErGrossPmts .assign(12, C0);
+ NetPmts .assign(12, C0);
InitializeSpecAmt();
}
@@ -1034,7 +1034,7 @@ void AccountValue::set_modal_min_premium()
currency AccountValue::SurrChg() const
{
- LMI_ASSERT(0.0 <= SurrChg_[Year]);
+ LMI_ASSERT(C0 <= SurrChg_[Year]);
// For the nonce, CSVBoost() is netted against surrender charge.
// This class's implementation should be revised to distinguish
// these additive and subtractive components of CSV.
@@ -1052,7 +1052,7 @@ currency AccountValue::CSVBoost() const
+ yare_input_.CashValueEnhancementRate[Year]
;
LMI_ASSERT(0.0 <= z);
- return z * std::max(0.0, TotalAccountValue());
+ return z * std::max(C0, TotalAccountValue());
}
//============================================================================
@@ -1184,7 +1184,7 @@ void AccountValue::FinalizeYear()
// While performing a solve, ignore any positive surrender charge
// that cannot cause the contract to lapse.
- if(Solving && 0.0 < surr_chg && LapseIgnoresSurrChg)
+ if(Solving && C0 < surr_chg && LapseIgnoresSurrChg)
{
; // Do nothing.
}
@@ -1197,7 +1197,7 @@ void AccountValue::FinalizeYear()
if(!Solving)
{
- csv_net = std::max(csv_net, 0.0);
+ csv_net = std::max(csv_net, C0);
}
if(Solving)
@@ -1215,7 +1215,7 @@ void AccountValue::FinalizeYear()
// the surrender charge are negative while others are positive,
// consider only their sum here, instead of considering the sign
// of each component individually.
- if(surr_chg < 0.0)
+ if(surr_chg < C0)
{
cv_7702 -= surr_chg;
}
@@ -1467,7 +1467,7 @@ currency AccountValue::GetSepAcctAssetsInforce() const
{
if(ItLapsed || BasicValues::GetLength() <= Year)
{
- return 0.0;
+ return C0;
}
return SepAcctValueAfterDeduction * partial_mortality_lx()[Year];
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index d73f660..c6c364a 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -130,8 +130,8 @@ void AccountValue::DoMonthDR()
,CashValueFor7702()
);
- NetPmts [Month] = 0.0; // TODO ?? expunge as being unnecessary
- GrossPmts[Month] = 0.0; // TODO ?? expunge as being unnecessary
+ NetPmts [Month] = C0; // TODO ?? expunge as being unnecessary
+ GrossPmts[Month] = C0; // TODO ?? expunge as being unnecessary
TxExch1035();
// TODO ?? TAXATION !! Is this where spec amt should be increased by GPT?
@@ -196,7 +196,7 @@ void AccountValue::DoMonthDR()
);
}
- double gross_1035 = 0.0;
+ double gross_1035 = C0;
if(0 == Year && 0 == Month)
{
gross_1035 = External1035Amount + Internal1035Amount;
@@ -269,18 +269,18 @@ void AccountValue::process_payment(currency payment)
// contracts. We deem net payments to have the same proportion
// as gross payments, which we do have for ee and er separately.
- LMI_ASSERT(0.0 <= GrossPmts[Month]);
- LMI_ASSERT(0.0 <= EeGrossPmts[Month]);
- LMI_ASSERT(0.0 <= ErGrossPmts[Month]);
+ LMI_ASSERT(C0 <= GrossPmts[Month]);
+ LMI_ASSERT(C0 <= EeGrossPmts[Month]);
+ LMI_ASSERT(C0 <= ErGrossPmts[Month]);
- double gross_1035 = 0.0;
+ double gross_1035 = C0;
if(0 == Year && 0 == Month)
{
gross_1035 = External1035Amount + Internal1035Amount;
}
double gross_non_1035_pmts = GrossPmts[Month] - gross_1035;
double er_proportion = 0.0;
- if(0.0 != gross_non_1035_pmts)
+ if(C0 != gross_non_1035_pmts)
{
er_proportion = ErGrossPmts[Month] / gross_non_1035_pmts;
}
@@ -419,8 +419,8 @@ void AccountValue::DecrementAVProportionally(currency
decrement)
if(materially_equal(decrement, AVGenAcct + AVSepAcct))
{
- AVGenAcct = 0.0;
- AVSepAcct = 0.0;
+ AVGenAcct = C0;
+ AVSepAcct = C0;
return;
}
@@ -483,8 +483,8 @@ void AccountValue::DecrementAVProgressively
{
if(materially_equal(decrement, AVGenAcct + AVSepAcct))
{
- AVGenAcct = 0.0;
- AVSepAcct = 0.0;
+ AVGenAcct = C0;
+ AVSepAcct = C0;
return;
}
@@ -513,16 +513,16 @@ void AccountValue::TxExch1035()
LMI_ASSERT(Year == InforceYear);
LMI_ASSERT(Month == InforceMonth);
- LMI_ASSERT(0.0 == GrossPmts[Month]);
- LMI_ASSERT(0.0 == EeGrossPmts[Month]);
- LMI_ASSERT(0.0 == ErGrossPmts[Month]);
+ LMI_ASSERT(C0 == GrossPmts[Month]);
+ LMI_ASSERT(C0 == EeGrossPmts[Month]);
+ LMI_ASSERT(C0 == ErGrossPmts[Month]);
// Policy issue date is always a modal payment date.
GrossPmts[Month] = External1035Amount + Internal1035Amount;
// TODO ?? TAXATION !! This looks like a good idea, but it would prevent the
// initial seven-pay premium from being set.
-// if(0.0 == GrossPmts[Month])
+// if(C0 == GrossPmts[Month])
// {
// return;
// }
@@ -556,7 +556,7 @@ void AccountValue::TxExch1035()
// TODO ?? Assume for now that all 1035 exchanges represent ee payments.
EeGrossPmts[Month] = GrossPmts[Month];
- double amount_exempt_from_premium_tax = 0.0;
+ double amount_exempt_from_premium_tax = C0;
if(WaivePmTxInt1035)
{
amount_exempt_from_premium_tax = Internal1035Amount;
@@ -568,11 +568,11 @@ void AccountValue::TxExch1035()
NetPmts[Month] = GrossPmts[Month] - actual_load;
- LMI_ASSERT(0.0 == AVGenAcct);
- LMI_ASSERT(0.0 == AVSepAcct);
+ LMI_ASSERT(C0 == AVGenAcct);
+ LMI_ASSERT(C0 == AVSepAcct);
process_payment(NetPmts[Month]);
- DBReflectingCorr = 0.0;
+ DBReflectingCorr = C0;
TxSetDeathBft();
TxSetTermAmt();
// TODO ?? TAXATION !! Should 1035 exchanges be handled somewhere else?
@@ -588,7 +588,7 @@ void AccountValue::TxExch1035()
if(HoneymoonActive)
{
- HoneymoonValue += std::max(0.0, GrossPmts[Month]);
+ HoneymoonValue += std::max(C0, GrossPmts[Month]);
}
CumPmts += GrossPmts[Month];
@@ -725,7 +725,7 @@ void AccountValue::ChangeSpecAmtBy(currency delta)
ActualSpecAmt = round_specamt()(ActualSpecAmt);
TermSpecAmt = old_total_specamt + delta - ActualSpecAmt;
- if(TermSpecAmt < 0.0)
+ if(TermSpecAmt < C0)
{
// Reducing the term rider's specified amount to a value
// less than zero is taken as a request to terminate the
@@ -795,7 +795,7 @@ void AccountValue::ChangeSupplAmtBy(currency delta)
TermSpecAmt = std::max
(TermSpecAmt
- ,0.0 // No minimum other than zero is defined.
+ ,C0 // No minimum other than zero is defined.
);
TermSpecAmt = round_specamt()(TermSpecAmt);
// At least for now, there is no effect on surrender charges.
@@ -813,7 +813,7 @@ void AccountValue::ChangeSupplAmtBy(currency delta)
//============================================================================
void AccountValue::InitializeMonth()
{
- GptForceout = 0.0;
+ GptForceout = C0;
premium_load_ = 0.0;
sales_load_ = 0.0;
premium_tax_load_ = 0.0;
@@ -886,18 +886,18 @@ void AccountValue::TxOptionChange()
{
if(mce_option2 == old_option)
{
- ChangeSpecAmtBy(std::max(0.0, TotalAccountValue()));
+ ChangeSpecAmtBy(std::max(C0, TotalAccountValue()));
}
else if(mce_rop == old_option)
{
- ChangeSpecAmtBy(std::max(0.0, CumPmts));
+ ChangeSpecAmtBy(std::max(C0, CumPmts));
}
else if(mce_mdb == old_option)
{
// Do nothing. An argument could be made for this
// alternative:
// TxSetDeathBft(); // update DBReflectingCorr
- // ChangeSpecAmtBy(std::max(0.0, DBReflectingCorr));
+ // ChangeSpecAmtBy(std::max(C0, DBReflectingCorr));
// but that takes more work and is not clearly
// preferable.
}
@@ -917,7 +917,7 @@ void AccountValue::TxOptionChange()
case mce_option2:
if(OptChgCanDecrSA)
{
- ChangeSpecAmtBy(-std::max(0.0, TotalAccountValue()));
+ ChangeSpecAmtBy(-std::max(C0, TotalAccountValue()));
}
else
{
@@ -927,7 +927,7 @@ void AccountValue::TxOptionChange()
case mce_rop:
if(OptChgCanDecrSA)
{
- ChangeSpecAmtBy(-std::max(0.0, CumPmts));
+ ChangeSpecAmtBy(-std::max(C0, CumPmts));
}
else
{
@@ -961,7 +961,7 @@ void AccountValue::TxSpecAmtChange()
// > post-1035 exchange calculation of the seven pay will have a death benefit
// > amount to base its calculations on.
#if 1
- ChangeSpecAmtBy(0.0);
+ ChangeSpecAmtBy(C0);
#else // 0
// TODO ?? Changing specamt by zero is absurd. The following
// commented-out alternative seems to do the same thing as
@@ -1191,7 +1191,7 @@ void AccountValue::TxAscertainDesiredPayment()
assert_pmts_add_up(__FILE__, __LINE__, Month);
- double eepmt = 0.0;
+ double eepmt = C0;
if(ee_pay_this_month)
{
eepmt = PerformEePmtStrategy();
@@ -1204,7 +1204,7 @@ void AccountValue::TxAscertainDesiredPayment()
GrossPmts [Month] += eepmt;
}
- double erpmt = 0.0;
+ double erpmt = C0;
if(er_pay_this_month)
{
erpmt = PerformErPmtStrategy();
@@ -1256,7 +1256,7 @@ void AccountValue::TxLimitPayment(double a_maxpmt)
if(mce_reduce_prem == yare_input_.AvoidMecMethod &&
!Irc7702A_->IsMecAlready())
{
- double gross_1035 = 0.0;
+ double gross_1035 = C0;
if(0 == Year && 0 == Month)
{
gross_1035 = External1035Amount + Internal1035Amount;
@@ -1299,7 +1299,7 @@ void AccountValue::TxRecognizePaymentFor7702A
,bool a_this_payment_is_unnecessary
)
{
- if(0.0 == a_pmt)
+ if(C0 == a_pmt)
{
return;
}
@@ -1339,17 +1339,17 @@ void AccountValue::TxRecognizePaymentFor7702A
//============================================================================
void AccountValue::TxAcceptPayment(currency a_pmt)
{
- if(0.0 == a_pmt)
+ if(C0 == a_pmt)
{
return;
}
- LMI_ASSERT(0.0 <= a_pmt);
+ LMI_ASSERT(C0 <= a_pmt);
// Internal 1035 exchanges may be exempt from premium tax; they're
// handled elsewhere, so here the exempt amount is always zero.
- double actual_load = GetPremLoad(a_pmt, 0.0);
+ double actual_load = GetPremLoad(a_pmt, C0);
double net_pmt = a_pmt - actual_load;
- LMI_ASSERT(0.0 <= net_pmt);
+ LMI_ASSERT(C0 <= net_pmt);
NetPmts[Month] += net_pmt;
// If a payment on an ROP contract is treated as an adjustable event,
@@ -1365,7 +1365,7 @@ void AccountValue::TxAcceptPayment(currency a_pmt)
if(HoneymoonActive)
{
- HoneymoonValue += std::max(0.0, a_pmt);
+ HoneymoonValue += std::max(C0, a_pmt);
}
CumPmts += a_pmt;
@@ -1406,7 +1406,7 @@ currency AccountValue::GetPremLoad
{
double excess_portion;
// All excess.
- if(0.0 == UnusedTargetPrem)
+ if(C0 == UnusedTargetPrem)
{
excess_portion = a_pmt;
}
@@ -1414,12 +1414,12 @@ currency AccountValue::GetPremLoad
else if(UnusedTargetPrem < a_pmt)
{
excess_portion = a_pmt - UnusedTargetPrem;
- UnusedTargetPrem = 0.0;
+ UnusedTargetPrem = C0;
}
// All target.
else
{
- excess_portion = 0.0;
+ excess_portion = C0;
UnusedTargetPrem -= a_pmt;
}
double target_portion = a_pmt - excess_portion;
@@ -1472,10 +1472,10 @@ currency AccountValue::GetRefundableSalesLoad() const
#if 0
// CURRENCY !! Assertions such as these are desirable, but adding
// them now would cause regression artifacts.
- LMI_ASSERT(0.0 <= CumulativeSalesLoad);
- LMI_ASSERT(0.0 <= YearsSalesLoadRefundRate);
+ LMI_ASSERT(C0 <= CumulativeSalesLoad);
+ LMI_ASSERT(C0 <= YearsSalesLoadRefundRate);
double const z = CumulativeSalesLoad * YearsSalesLoadRefundRate;
- LMI_ASSERT(0.0 <= z);
+ LMI_ASSERT(C0 <= z);
return z;
#endif // 0
}
@@ -1491,7 +1491,7 @@ void AccountValue::TxLoanRepay()
}
// Nothing to do if no loan repayment requested.
- if(0.0 <= RequestedLoan)
+ if(C0 <= RequestedLoan)
{
return;
}
@@ -1501,8 +1501,8 @@ void AccountValue::TxLoanRepay()
ActualLoan = -std::min(-RequestedLoan, RegLnBal + PrfLnBal);
process_distribution(ActualLoan);
- LMI_ASSERT(0.0 == progressively_reduce(AVRegLn , AVPrfLn , -ActualLoan));
- LMI_ASSERT(0.0 == progressively_reduce(RegLnBal, PrfLnBal, -ActualLoan));
+ LMI_ASSERT(C0 == progressively_reduce(AVRegLn , AVPrfLn , -ActualLoan));
+ LMI_ASSERT(C0 == progressively_reduce(RegLnBal, PrfLnBal, -ActualLoan));
// This seems wrong. If we're changing something that's invariant among
// bases, why do we change it for each basis?
@@ -1524,7 +1524,7 @@ void AccountValue::TxSetBOMAV()
{
if(!yare_input_.TermRider && !TermIsNotRider)
{
- LMI_ASSERT(0.0 == term_specamt(0));
+ LMI_ASSERT(C0 == term_specamt(0));
}
LMI_ASSERT(yare_input_.InforceSpecAmtLoadBase <= SpecAmtLoadLimit);
SpecAmtLoadBase =
@@ -1600,7 +1600,7 @@ void AccountValue::TxSetDeathBft()
case mce_option2:
{
// Negative AV doesn't decrease death benefit.
- DBIgnoringCorr = ActualSpecAmt + std::max(0.0,
TotalAccountValue());
+ DBIgnoringCorr = ActualSpecAmt + std::max(C0, TotalAccountValue());
DB7702A = ActualSpecAmt;
}
break;
@@ -1609,8 +1609,8 @@ void AccountValue::TxSetDeathBft()
// SA + sum of premiums less withdrawals, but not < SA;
// i.e., ignore 'CumPmts' if it is less than zero, as it
// easily can be, e.g., if WDs are not limited to basis.
- DBIgnoringCorr = ActualSpecAmt + std::max(0.0, CumPmts);
- DB7702A = ActualSpecAmt + std::max(0.0, CumPmts);
+ DBIgnoringCorr = ActualSpecAmt + std::max(C0, CumPmts);
+ DB7702A = ActualSpecAmt + std::max(C0, CumPmts);
}
break;
case mce_mdb:
@@ -1618,18 +1618,18 @@ void AccountValue::TxSetDeathBft()
// Specamt is a floor under DB (and therefore zero here)
// because this option defines the DB as the minimum
// required by the corridor (but not less than zero).
- DBIgnoringCorr = 0.0;
- DB7702A = 0.0;
+ DBIgnoringCorr = C0;
+ DB7702A = C0;
}
break;
}
- LMI_ASSERT(0.0 <= DBIgnoringCorr);
+ LMI_ASSERT(C0 <= DBIgnoringCorr);
// Surrender charges are generally ignored here, but any negative
// surrender charge must be subtracted, increasing the account value.
double cash_value_for_corridor =
TotalAccountValue()
- - std::min(0.0, SurrChg())
+ - std::min(C0, SurrChg())
+ GetRefundableSalesLoad()
// + std::max(0.0, ExpRatReserve) // This would be added if it existed.
;
@@ -1641,10 +1641,10 @@ void AccountValue::TxSetDeathBft()
DBReflectingCorr = std::max
(DBIgnoringCorr
- ,YearsCorridorFactor * std::max(0.0, cash_value_for_corridor)
+ ,YearsCorridorFactor * std::max(C0, cash_value_for_corridor)
);
DBReflectingCorr = round_death_benefit()(DBReflectingCorr);
- LMI_ASSERT(0.0 <= DBReflectingCorr);
+ LMI_ASSERT(C0 <= DBReflectingCorr);
// This overrides the value assigned above. There's more than one
// way to interpret 7702A "death benefit"; this is just one.
// TAXATION !! Use DB_Irc7702BftIsSpecAmt
@@ -1655,7 +1655,7 @@ void AccountValue::TxSetDeathBft()
, (
YearsCorridorFactor
* ( Dcv
- - std::min(0.0, SurrChg())
+ - std::min(C0, SurrChg())
+ GetRefundableSalesLoad()
// + std::max(0.0, ExpRatReserve) // This would be added if
it existed.
)
@@ -1690,7 +1690,7 @@ void AccountValue::TxSetTermAmt()
return;
}
- TermDB = std::max(0.0, TermSpecAmt + DBIgnoringCorr - DBReflectingCorr);
+ TermDB = std::max(C0, TermSpecAmt + DBIgnoringCorr - DBReflectingCorr);
TermDB = round_death_benefit()(TermDB);
}
@@ -1721,8 +1721,8 @@ void AccountValue::EndTermRider(bool convert)
{
ChangeSpecAmtBy(TermSpecAmt);
}
- TermSpecAmt = 0.0;
- TermDB = 0.0;
+ TermSpecAmt = C0;
+ TermDB = C0;
// Carry the new term spec amt forward into all future years.
for(int j = Year; j < BasicValues::GetLength(); ++j)
{
@@ -1801,28 +1801,28 @@ void AccountValue::TxSetCoiCharge()
void AccountValue::TxSetRiderDed()
{
- AdbCharge = 0.0;
+ AdbCharge = C0;
if(yare_input_.AccidentalDeathBenefit)
{
AdbCharge = YearsAdbRate * std::min(ActualSpecAmt, AdbLimit);
AdbCharge = round_rider_charges()(AdbCharge);
}
- SpouseRiderCharge = 0.0;
+ SpouseRiderCharge = C0;
if(yare_input_.SpouseRider)
{
SpouseRiderCharge = YearsSpouseRiderRate *
yare_input_.SpouseRiderAmount;
SpouseRiderCharge = round_rider_charges()(SpouseRiderCharge);
}
- ChildRiderCharge = 0.0;
+ ChildRiderCharge = C0;
if(yare_input_.ChildRider)
{
ChildRiderCharge = YearsChildRiderRate * yare_input_.ChildRiderAmount;
ChildRiderCharge = round_rider_charges()(ChildRiderCharge);
}
- TermCharge = 0.0;
+ TermCharge = C0;
DcvTermCharge = 0.0;
if(TermRiderActive)
{
@@ -1835,7 +1835,7 @@ void AccountValue::TxSetRiderDed()
DcvTermCharge = YearsDcvCoiRate * TermDB * DBDiscountRate[Year];
}
- WpCharge = 0.0;
+ WpCharge = C0;
DcvWpCharge = 0.0;
if(yare_input_.WaiverOfPremiumBenefit)
{
@@ -1888,7 +1888,7 @@ void AccountValue::TxDoMlyDed()
if(TermRiderActive && TermCanLapse && (AVGenAcct + AVSepAcct - CoiCharge)
< TermCharge)
{
EndTermRider(false);
- TermCharge = 0.0;
+ TermCharge = C0;
}
// 'Simple' riders are the same for AV and DCV.
@@ -1960,7 +1960,7 @@ void AccountValue::TxTestHoneymoonForExpiration()
// And it doesn't make sense for the honeymoon provision to
// keep the contract in force if 'HoneymoonValue' is -10000
// and CSV is -20000.
- if(HoneymoonValue <= 0.0 || HoneymoonValue < csv_ignoring_loan)
+ if(HoneymoonValue <= C0 || HoneymoonValue < csv_ignoring_loan)
{
HoneymoonActive = false;
HoneymoonValue = -std::numeric_limits<double>::max();
@@ -2118,7 +2118,7 @@ void AccountValue::TxCreditInt()
{
ApplyDynamicMandE(AssetsPostBom);
- double notional_sep_acct_charge = 0.0;
+ double notional_sep_acct_charge = C0;
// SOMEDAY !! This should be done in the interest-rate class.
double gross_sep_acct_rate = i_upper_12_over_12_from_i<double>()
@@ -2151,7 +2151,7 @@ void AccountValue::TxCreditInt()
}
else
{
- SepAcctIntCred = 0.0;
+ SepAcctIntCred = C0;
}
if(0.0 < AVGenAcct)
@@ -2175,7 +2175,7 @@ void AccountValue::TxCreditInt()
}
else
{
- GenAcctIntCred = 0.0;
+ GenAcctIntCred = C0;
}
LMI_ASSERT(0.0 <= Dcv);
@@ -2193,7 +2193,7 @@ void AccountValue::TxCreditInt()
}
// Loaned account value must not be negative.
- LMI_ASSERT(0.0 <= AVRegLn && 0.0 <= AVPrfLn);
+ LMI_ASSERT(C0 <= AVRegLn && C0 <= AVPrfLn);
double z = RegLnIntCred + PrfLnIntCred + SepAcctIntCred + GenAcctIntCred;
YearsTotalNetIntCredited += z;
@@ -2206,11 +2206,11 @@ void AccountValue::TxLoanInt()
{
// Reinitialize to zero before potential early exit, to sweep away
// any leftover values (e.g., after a loan has been paid off).
- RegLnIntCred = 0.0;
- PrfLnIntCred = 0.0;
+ RegLnIntCred = C0;
+ PrfLnIntCred = C0;
// Nothing more to do if there's no loan outstanding.
- if(0.0 == RegLnBal && 0.0 == PrfLnBal)
+ if(C0 == RegLnBal && C0 == PrfLnBal)
{
return;
}
@@ -2316,20 +2316,20 @@ void AccountValue::TxTakeWD()
return;
}
- GrossWD = 0.0;
+ GrossWD = C0;
RequestedWD = Outlay_->withdrawals()[Year];
- if(Debugging || 0.0 != RequestedWD)
+ if(Debugging || C0 != RequestedWD)
{
SetMaxWD();
}
- NetWD = 0.0;
+ NetWD = C0;
// Nothing more to do if no withdrawal requested.
- if(0.0 == RequestedWD)
+ if(C0 == RequestedWD)
{
- withdrawal_ullage_[Year] = 0.0;
+ withdrawal_ullage_[Year] = C0;
// This seems wrong. If we're changing something that's invariant among
// bases, why do we change it for each basis?
// TODO ?? Shouldn't this be moved to FinalizeMonth()?
@@ -2343,7 +2343,7 @@ void AccountValue::TxTakeWD()
if(Solving)
{
- withdrawal_ullage_[Year] = std::max(0.0, RequestedWD - MaxWD);
+ withdrawal_ullage_[Year] = std::max(C0, RequestedWD - MaxWD);
}
if(Solving || mce_run_gen_curr_sep_full == RunBasis_)
@@ -2367,8 +2367,8 @@ void AccountValue::TxTakeWD()
// Impose minimum amount on withdrawals.
if(RequestedWD < MinWD)
{
- withdrawal_ullage_[Year] = 0.0;
- NetWD = 0.0;
+ withdrawal_ullage_[Year] = C0;
+ NetWD = C0;
}
// TODO ?? If WD zero, skip some steps? Cannot simply return in this case
// because user may prefer to shift to loans.
@@ -2389,10 +2389,10 @@ void AccountValue::TxTakeWD()
// Even after the entire basis has been withdrawn, we still
// take withdrawals if payments since have increased the basis.
// TODO ?? Should RequestedWD be constrained by MaxWD and MinWD here?
- if(0.0 == TaxBasis || std::min(TaxBasis, RequestedWD) < MinWD) // All
loan
+ if(C0 == TaxBasis || std::min(TaxBasis, RequestedWD) < MinWD) // All
loan
{
- withdrawal_ullage_[Year] = 0.0;
- NetWD = 0.0;
+ withdrawal_ullage_[Year] = C0;
+ NetWD = C0;
}
else if(NetWD < TaxBasis) // All WD
{
@@ -2407,7 +2407,7 @@ void AccountValue::TxTakeWD()
RequestedLoan += RequestedWD - NetWD;
}
- if(NetWD <= 0.0)
+ if(NetWD <= C0)
{
// TODO ?? What should this be?
// withdrawal_ullage_[Year] = ?
@@ -2461,8 +2461,8 @@ void AccountValue::TxTakeWD()
double av = TotalAccountValue();
double csv = av - SurrChg_[Year];
- LMI_ASSERT(0.0 <= SurrChg_[Year]);
- if(csv <= 0.0)
+ LMI_ASSERT(C0 <= SurrChg_[Year]);
+ if(csv <= C0)
{
// TODO ?? What should this be?
// withdrawal_ullage_[Year] = ?
@@ -2492,7 +2492,7 @@ void AccountValue::TxTakeWD()
LMI_ASSERT(AVPrfLn == PrfLnBal);
LMI_ASSERT(av == AVGenAcct + AVSepAcct);
double free_wd = FreeWDProportion[Year] * av;
- non_free_wd = std::max(0.0, GrossWD - free_wd);
+ non_free_wd = std::max(C0, GrossWD - free_wd);
}
double partial_surrchg = non_free_wd * surrchg_proportion;
GrossWD += round_withdrawal()(partial_surrchg);
@@ -2599,7 +2599,7 @@ void AccountValue::SetMaxLoan()
(AVGenAcct + AVSepAcct) * MaxLoanAVMult
+ (AVRegLn + AVPrfLn)
- anticipated_deduction(MaxLoanDed_)
- - std::max(0.0, SurrChg())
+ - std::max(C0, SurrChg())
;
// Illustrations generally permit loans only on anniversary.
@@ -2665,15 +2665,15 @@ void AccountValue::TxTakeLoan()
// Even if no loan is requested, the maximum loan is still shown
// in a monthly trace.
- if(Debugging || 0.0 <= RequestedLoan)
+ if(Debugging || C0 <= RequestedLoan)
{
SetMaxLoan();
}
// Nothing more to do if no loan requested.
- if(RequestedLoan <= 0.0)
+ if(RequestedLoan <= C0)
{
- loan_ullage_[Year] = 0.0;
+ loan_ullage_[Year] = C0;
return;
}
@@ -2685,12 +2685,12 @@ void AccountValue::TxTakeLoan()
if(Solving)
{
ActualLoan = RequestedLoan;
- loan_ullage_[Year] = std::max(0.0, RequestedLoan - max_loan_increment);
+ loan_ullage_[Year] = std::max(C0, RequestedLoan - max_loan_increment);
}
else
{
ActualLoan = std::min(max_loan_increment, RequestedLoan);
- ActualLoan = std::max(ActualLoan, 0.0);
+ ActualLoan = std::max(ActualLoan, C0);
// TODO ?? Shouldn't this happen in FinalizeMonth()?
InvariantValues().NewCashLoan[Year] = ActualLoan;
}
@@ -2770,7 +2770,7 @@ void AccountValue::TxTestLapse()
;
if(!LapseIgnoresSurrChg)
{
- lapse_test_csv -= std::max(0.0, SurrChg());
+ lapse_test_csv -= std::max(C0, SurrChg());
}
lapse_test_csv = std::max(lapse_test_csv, HoneymoonValue);
@@ -2809,11 +2809,11 @@ void AccountValue::TxTestLapse()
// Otherwise if CSV is negative or if overloaned, then lapse the policy.
else if
(
- (!NoLapseActive && lapse_test_csv < 0.0)
+ (!NoLapseActive && lapse_test_csv < C0)
// Lapse if overloaned regardless of guar DB.
// CSV includes a positive loan (that can offset a negative AV);
// however, we still need to test for NoLapseActive.
- || (!NoLapseActive && (AVGenAcct + AVSepAcct) < 0.0)
+ || (!NoLapseActive && (AVGenAcct + AVSepAcct) < C0)
// Test for nonnegative unloaned account value.
// We are aware that some companies test against loan balance:
// TODO ?? Would the explicit test
@@ -2841,14 +2841,14 @@ void AccountValue::TxTestLapse()
}
else
{
- if(NoLapseActive && lapse_test_csv < 0.0)
+ if(NoLapseActive && lapse_test_csv < C0)
{
- AVGenAcct = 0.0;
- AVSepAcct = 0.0;
+ AVGenAcct = C0;
+ AVSepAcct = C0;
// TODO ?? Can't this be done elsewhere?
VariantValues().CSVNet[Year] = 0.0;
}
- else if(!HoneymoonActive && !Solving && lapse_test_csv < 0.0)
+ else if(!HoneymoonActive && !Solving && lapse_test_csv < C0)
{
alarum()
<< "Unloaned value not positive,"
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 659509e..436c3fc 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -1540,7 +1540,7 @@ currency BasicValues::GetModalSpecAmtMlyDed(currency,
mcenum_mode) const
<< "No maximum specified amount is defined for this product."
<< LMI_FLUSH
;
- return 0.0;
+ return C0;
}
/// 'Unusual' banding is one particular approach we needed to model.
- [lmi-commits] [lmi] master 2084088 09/15: Record speed measurements, (continued)
- [lmi-commits] [lmi] master 2084088 09/15: Record speed measurements, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master da240e8 03/15: Eliminate a return code that was always zero, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master d280c59 05/15: Fix a unit test, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 7b51fab 07/15: Adapt to currency class, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master f7a1129 08/15: Store policy fees as currency, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 2666c48 06/15: Test rounding double to currency, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 5ed8f75 04/15: Refactor a unit test, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 6a6ebe3 11/15: Adapt to currency class, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 1d5c923 01/15: Change some internal names, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 1e5d1ea 12/15: Adapt to currency class, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 27bd748 13/15: Write $0.00 as a currency rather than floating-point constant,
Greg Chicares <=
- [lmi-commits] [lmi] master 9d991b0 15/15: Round currency as such, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master 306ba4e 02/15: Introduce optional (for now) currency class, Greg Chicares, 2021/01/25
- [lmi-commits] [lmi] master fd106fc 14/15: Reformat, Greg Chicares, 2021/01/25