[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 237cf72 2/2: Use currency operator"" _cents()
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 237cf72 2/2: Use currency operator"" _cents() |
Date: |
Sat, 8 May 2021 13:35:51 -0400 (EDT) |
branch: master
commit 237cf72453ee5dba15146d18445c99a650e00d48
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Use currency operator"" _cents()
---
accountvalue.cpp | 2 +-
ihs_avsolve.cpp | 3 +--
loads_test.cpp | 14 +++++++-------
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 308f50b..f428db9 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -803,7 +803,7 @@ void AccountValue::TxSetRiderDed()
AdbCharge = round_rider_charges().c
( YearsAdbRate
// IHS !! Icky manifest constant--lmi uses a database entity.
- * std::min(from_cents(50000000), ActualSpecAmt)
+ * std::min(500'000'00_cents, ActualSpecAmt)
);
}
}
diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index 79cdb89..ed12df6 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -249,8 +249,7 @@ currency AccountValue::SolveTest(currency a_CandidateValue)
if(mce_solve_for_non_mec == SolveTarget_)
{
- static const currency C100 = from_cents(100); // one dollar
- return InvariantValues().IsMec ? -C100 : C100;
+ return InvariantValues().IsMec ? -100_cents : 100_cents;
}
return value - SolveTargetCsv_;
diff --git a/loads_test.cpp b/loads_test.cpp
index 3c5f2d1..9fdd28f 100644
--- a/loads_test.cpp
+++ b/loads_test.cpp
@@ -87,8 +87,8 @@ void LoadsTest::Reinitialize()
loads_.refundable_sales_load_proportion_ = std::vector<double>
(length, 0.50000);
loads_.dac_tax_load_ = std::vector<double>
(length, 0.00500);
- loads_.monthly_policy_fee_ [mce_gen_guar] =
std::vector<currency>(length, from_cents(800));
- loads_.annual_policy_fee_ [mce_gen_guar] =
std::vector<currency>(length, from_cents(200));
+ loads_.monthly_policy_fee_ [mce_gen_guar] =
std::vector<currency>(length, 800_cents);
+ loads_.annual_policy_fee_ [mce_gen_guar] =
std::vector<currency>(length, 200_cents);
loads_.specified_amount_load_[mce_gen_guar] = std::vector<double>
(length, 0.00003);
loads_.separate_account_load_[mce_gen_guar] = std::vector<double>
(length, 0.00130);
loads_.target_premium_load_ [mce_gen_guar] = std::vector<double>
(length, 0.04000);
@@ -96,8 +96,8 @@ 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<currency>(length, from_cents(525));
- loads_.annual_policy_fee_ [mce_gen_curr] =
std::vector<currency>(length, from_cents(100));
+ loads_.monthly_policy_fee_ [mce_gen_curr] =
std::vector<currency>(length, 525_cents);
+ loads_.annual_policy_fee_ [mce_gen_curr] =
std::vector<currency>(length, 100_cents);
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);
loads_.target_premium_load_ [mce_gen_curr] = std::vector<double>
(length, 0.02000);
@@ -160,8 +160,8 @@ void LoadsTest::TestCalculations(char const* file, int line)
INVOKE_LMI_TEST(materially_equal(0.500000,
loads_.refundable_sales_load_proportion()[0]), file, line);
// (8.00 + 5.25 + 0.50) / 2 = 13.75 / 2 = 6.875, rounded to cents
- INVOKE_LMI_TEST(from_cents(688) == loads_.monthly_policy_fee
(mce_gen_mdpt)[0] , file, line);
- INVOKE_LMI_TEST(from_cents(150) == loads_.annual_policy_fee
(mce_gen_mdpt)[0] , file, line);
+ INVOKE_LMI_TEST(688_cents == loads_.monthly_policy_fee (mce_gen_mdpt)[0] ,
file, line);
+ INVOKE_LMI_TEST(150_cents == loads_.annual_policy_fee (mce_gen_mdpt)[0] ,
file, line);
INVOKE_LMI_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.
INVOKE_LMI_TEST(materially_equal(0.0002581402795930,
loads_.separate_account_load (mce_gen_mdpt)[0]), file, line);
@@ -197,7 +197,7 @@ int test_main(int, char*[])
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<currency> extra_policy_fee (length, from_cents(50));
+ std::vector<currency> extra_policy_fee (length, 50_cents);
std::vector<double> guar_specamt_load(length, 0.0007);
std::vector<double> curr_specamt_load(length, 0.0005);