[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7935a5f 1/2: Avoid gratuitous use of long int
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7935a5f 1/2: Avoid gratuitous use of long int |
Date: |
Wed, 6 Jun 2018 08:26:43 -0400 (EDT) |
branch: master
commit 7935a5f46d5ccf1cc72b50ea97aa25dfa8c02aed
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Avoid gratuitous use of long int
Changed table numbers passed to actuarial_table_rates() from long int
to plain int. Code stemming from 1990s originals had used long int in
case more than 2^(16-1) tables were ever needed, but after two decades
lmi uses fewer than six hundred, including proprietary ones. Moreover,
actuarial_table_rates() takes only a plain int table-number argument.
---
basic_values.hpp | 2 +-
gpt_server.cpp | 9 +++++----
ihs_basicval.cpp | 11 ++++++-----
mec_server.cpp | 9 +++++----
mortality_rates.cpp | 11 ++++++-----
5 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/basic_values.hpp b/basic_values.hpp
index b632790..da151aa 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -402,7 +402,7 @@ class LMI_SO BasicValues
std::vector<double> GetActuarialTable
(std::string const& TableFile
,e_database_key TableID
- ,long int TableNumber
+ ,int TableNumber
) const;
std::vector<double> GetUnblendedTable
diff --git a/gpt_server.cpp b/gpt_server.cpp
index 92a8fcf..a438f48 100644
--- a/gpt_server.cpp
+++ b/gpt_server.cpp
@@ -26,6 +26,7 @@
#include "actuarial_table.hpp"
#include "alert.hpp"
#include "assert_lmi.hpp"
+#include "bourn_cast.hpp"
#include "commutation_functions.hpp"
#include "configurable_settings.hpp"
#include "contains.hpp"
@@ -147,7 +148,7 @@ gpt_state test_one_days_gpt_transactions
{
TargetPremiumRates = actuarial_table_rates
(AddDataDir(product_filenames.datum("TgtPremFilename"))
- ,static_cast<long int>(database.Query(DB_TgtPremTable))
+ ,bourn_cast<int>(database.Query(DB_TgtPremTable))
,input.issue_age()
,input.years_to_maturity()
);
@@ -159,7 +160,7 @@ gpt_state test_one_days_gpt_transactions
std::vector<double> const CvatCorridorFactors = actuarial_table_rates
(AddDataDir(product_filenames.datum("CvatCorridorFilename"))
- ,static_cast<long int>(database.Query(DB_CorridorTable))
+ ,bourn_cast<int>(database.Query(DB_CorridorTable))
,input.issue_age()
,input.years_to_maturity()
);
@@ -174,14 +175,14 @@ gpt_state test_one_days_gpt_transactions
std::vector<double> const tabular_7Px = actuarial_table_rates
(AddDataDir(product_filenames.datum("SevenPayFilename"))
- ,static_cast<long int>(database.Query(DB_SevenPayTable))
+ ,bourn_cast<int>(database.Query(DB_SevenPayTable))
,input.issue_age()
,input.years_to_maturity()
);
std::vector<double> Mly7702qc = actuarial_table_rates
(AddDataDir(product_filenames.datum("Irc7702QFilename"))
- ,static_cast<long int>(database.Query(DB_Irc7702QTable))
+ ,bourn_cast<int>(database.Query(DB_Irc7702QTable))
,input.issue_age()
,input.years_to_maturity()
);
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 48cff03..4f8bb28 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -25,6 +25,7 @@
#include "alert.hpp"
#include "assert_lmi.hpp"
+#include "bourn_cast.hpp"
#include "calendar_date.hpp"
#include "contains.hpp"
#include "data_directory.hpp"
@@ -1536,7 +1537,7 @@ std::vector<double> const& BasicValues::GetBandedCoiRates
std::vector<double> BasicValues::GetActuarialTable
(std::string const& TableFile
,e_database_key TableID
- ,long int TableNumber
+ ,int TableNumber
) const
{
if(DB_CurrCoiTable == TableID && e_reenter_never != CoiInforceReentry)
@@ -1571,7 +1572,7 @@ std::vector<double> BasicValues::GetUnblendedTable
return GetActuarialTable
(TableFile
,TableID
- ,static_cast<long int>(Database_->Query(TableID))
+ ,bourn_cast<int>(Database_->Query(TableID))
);
}
@@ -1587,7 +1588,7 @@ std::vector<double> BasicValues::GetUnblendedTable
return GetActuarialTable
(TableFile
,TableID
- ,static_cast<long int>(Database_->Query(TableID, index))
+ ,bourn_cast<int>(Database_->Query(TableID, index))
);
}
@@ -1975,7 +1976,7 @@ std::vector<double>
BasicValues::GetCurrentSpouseRiderRates() const
std::vector<double> z = actuarial_table_rates
(AddDataDir(ProductData_->datum("CurrSpouseRiderFilename"))
- ,static_cast<long int>(Database_->Query(DB_SpouseRiderTable))
+ ,bourn_cast<int>(Database_->Query(DB_SpouseRiderTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
);
@@ -1992,7 +1993,7 @@ std::vector<double>
BasicValues::GetGuaranteedSpouseRiderRates() const
std::vector<double> z = actuarial_table_rates
(AddDataDir(ProductData_->datum("GuarSpouseRiderFilename"))
- ,static_cast<long int>(Database_->Query(DB_SpouseRiderGuarTable))
+ ,bourn_cast<int>(Database_->Query(DB_SpouseRiderGuarTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
);
diff --git a/mec_server.cpp b/mec_server.cpp
index 10e7f46..7f944f4 100644
--- a/mec_server.cpp
+++ b/mec_server.cpp
@@ -26,6 +26,7 @@
#include "actuarial_table.hpp"
#include "alert.hpp"
#include "assert_lmi.hpp"
+#include "bourn_cast.hpp"
#include "commutation_functions.hpp"
#include "configurable_settings.hpp"
#include "contains.hpp"
@@ -130,7 +131,7 @@ mec_state test_one_days_7702A_transactions
{
TargetPremiumRates = actuarial_table_rates
(AddDataDir(product_filenames.datum("TgtPremFilename"))
- ,static_cast<long int>(database.Query(DB_TgtPremTable))
+ ,bourn_cast<int>(database.Query(DB_TgtPremTable))
,input.issue_age()
,input.years_to_maturity()
);
@@ -142,7 +143,7 @@ mec_state test_one_days_7702A_transactions
std::vector<double> const CvatCorridorFactors = actuarial_table_rates
(AddDataDir(product_filenames.datum("CvatCorridorFilename"))
- ,static_cast<long int>(database.Query(DB_CorridorTable))
+ ,bourn_cast<int>(database.Query(DB_CorridorTable))
,input.issue_age()
,input.years_to_maturity()
);
@@ -157,14 +158,14 @@ mec_state test_one_days_7702A_transactions
std::vector<double> const tabular_7Px = actuarial_table_rates
(AddDataDir(product_filenames.datum("SevenPayFilename"))
- ,static_cast<long int>(database.Query(DB_SevenPayTable))
+ ,bourn_cast<int>(database.Query(DB_SevenPayTable))
,input.issue_age()
,input.years_to_maturity()
);
std::vector<double> Mly7702qc = actuarial_table_rates
(AddDataDir(product_filenames.datum("Irc7702QFilename"))
- ,static_cast<long int>(database.Query(DB_Irc7702QTable))
+ ,bourn_cast<int>(database.Query(DB_Irc7702QTable))
,input.issue_age()
,input.years_to_maturity()
);
diff --git a/mortality_rates.cpp b/mortality_rates.cpp
index 9f2128d..4c5ca77 100644
--- a/mortality_rates.cpp
+++ b/mortality_rates.cpp
@@ -26,6 +26,7 @@
#include "actuarial_table.hpp"
#include "alert.hpp"
#include "basic_values.hpp"
+#include "bourn_cast.hpp"
#include "database.hpp"
#include "dbnames.hpp"
#include "math_functions.hpp" // assign_midpoint()
@@ -46,14 +47,14 @@ void MortalityRates::Init(BasicValues const& basic_values)
MonthlyCurrentCoiRatesBand0_ = actuarial_table_rates
(CurrentTableFile()
- ,static_cast<long int>(basic_values.Database_->Query(DB_CurrCoiTable))
+ ,bourn_cast<int>(basic_values.Database_->Query(DB_CurrCoiTable))
,issue_age
,length
);
MonthlyGuaranteedCoiRates_ = actuarial_table_rates
(GuaranteedTableFile()
- ,static_cast<long int>(basic_values.Database_->Query(DB_GuarCoiTable))
+ ,bourn_cast<int>(basic_values.Database_->Query(DB_GuarCoiTable))
,issue_age
,length
);
@@ -72,21 +73,21 @@ void MortalityRates::Init(BasicValues const& basic_values)
CvatCorridorFactors_ = actuarial_table_rates
(CurrentTableFile()
- ,static_cast<long int>(basic_values.Database_->Query(DB_CorridorTable))
+ ,bourn_cast<int>(basic_values.Database_->Query(DB_CorridorTable))
,issue_age
,length
);
AdbRates_ = actuarial_table_rates
(CurrentTableFile()
- ,static_cast<long int>(basic_values.Database_->Query(DB_AdbTable))
+ ,bourn_cast<int>(basic_values.Database_->Query(DB_AdbTable))
,issue_age
,length
);
WpRates_ = actuarial_table_rates
(CurrentTableFile()
- ,static_cast<long int>(basic_values.Database_->Query(DB_WpTable))
+ ,bourn_cast<int>(basic_values.Database_->Query(DB_WpTable))
,issue_age
,length
);