lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master b2d963e 08/10: Rename some struct members


From: Greg Chicares
Subject: [lmi-commits] [lmi] master b2d963e 08/10: Rename some struct members
Date: Sun, 18 Apr 2021 18:21:03 -0400 (EDT)

branch: master
commit b2d963ee6c234d5b50c3f226bd9fa13a4a4b523f
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Rename some struct members
    
    Reasons:
      f3bft --> f3_bft
    concinnity, especially with 'endt_bft'
      target --> target_prem
    common English words are hard to grep for
      chg_sa_amt --> chg_sa_base
    more descriptive; distinguished clearly from 'qab_.*_amt'
---
 gpt_cf_triad_test.cpp         | 30 +++++++++++++++---------------
 gpt_commutation_functions.cpp | 14 +++++++-------
 gpt_commutation_functions.hpp |  8 ++++----
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/gpt_cf_triad_test.cpp b/gpt_cf_triad_test.cpp
index e708286..4099e3c 100644
--- a/gpt_cf_triad_test.cpp
+++ b/gpt_cf_triad_test.cpp
@@ -308,10 +308,10 @@ gpt_scalar_parms gpt_cf_triad_test::s_parms()
 {
     gpt_scalar_parms z =
         {.duration       =      0
-        ,.f3bft          = 120000.0
+        ,.f3_bft         = 120000.0
         ,.endt_bft       = 100000.0
-        ,.target         =   1000.0
-        ,.chg_sa_amt     = 100000.0
+        ,.target_prem    =   1000.0
+        ,.chg_sa_base    = 100000.0
         ,.qab_gio_amt    =  20000.0
         ,.qab_adb_amt    = 100000.0
         ,.qab_term_amt   =  25000.0
@@ -357,7 +357,7 @@ void gpt_cf_triad_test::test_preconditions()
 
     // Negative target. (Identical preconditions for other scalar
     // parameters are not redundantly tested here.)
-    parms.target = -0.01;
+    parms.target_prem = -0.01;
     LMI_TEST_THROW
         (z.calculate_premium(oe_gsp, mce_option1_for_7702, parms)
         ,std::runtime_error
@@ -473,18 +473,18 @@ Irc7702 gpt_cf_triad_test::instantiate_old(int issue_age)
 void gpt_cf_triad_test::compare_premiums(int issue_age, double target)
 {
     gpt_scalar_parms parms = s_parms();
-    parms.target = target;
+    parms.target_prem = target;
 
     initialize(issue_age);
 
     gpt_cf_triad const z = instantiate_cf();
 
-    double const f3bft    = parms.f3bft   ;
+    double const f3_bft   = parms.f3_bft  ;
     double const endt_bft = parms.endt_bft;
     // This test of the obsolescent class segfaults with como.
     Irc7702 z_old = instantiate_old(issue_age);
     // Set target (the other arguments don't matter here).
-    z_old.Initialize7702(f3bft, endt_bft, mce_option1_for_7702, target);
+    z_old.Initialize7702(f3_bft, endt_bft, mce_option1_for_7702, target);
 
     int const omega = lmi::ssize(sample_q(0));
     LMI_ASSERT(lmi::ssize(qab_waiver_rate) == omega - issue_age);
@@ -494,9 +494,9 @@ void gpt_cf_triad_test::compare_premiums(int issue_age, 
double target)
         double const r0 = z.calculate_premium(oe_gsp, mce_option1_for_7702, 
parms);
         double const r1 = z.calculate_premium(oe_glp, mce_option1_for_7702, 
parms);
         double const r2 = z.calculate_premium(oe_glp, mce_option2_for_7702, 
parms);
-        double const r0_old = z_old.CalculateGSP(duration, f3bft, endt_bft, 
endt_bft                      );
-        double const r1_old = z_old.CalculateGLP(duration, f3bft, endt_bft, 
endt_bft, mce_option1_for_7702);
-        double const r2_old = z_old.CalculateGLP(duration, f3bft, endt_bft, 
endt_bft, mce_option2_for_7702);
+        double const r0_old = z_old.CalculateGSP(duration, f3_bft, endt_bft, 
endt_bft                      );
+        double const r1_old = z_old.CalculateGLP(duration, f3_bft, endt_bft, 
endt_bft, mce_option1_for_7702);
+        double const r2_old = z_old.CalculateGLP(duration, f3_bft, endt_bft, 
endt_bft, mce_option2_for_7702);
         bool const all_materially_equal =
                materially_equal(r0, r0_old)
             && materially_equal(r1, r1_old)
@@ -539,7 +539,7 @@ void gpt_cf_triad_test::test_premium_calculations()
         }
 
     gpt_scalar_parms parms = s_parms();
-    parms.target = touchstone_target;
+    parms.target_prem = touchstone_target;
     int count = 0;
     for(int issue_age = 0; issue_age < omega; ++issue_age)
         {
@@ -587,12 +587,12 @@ void gpt_cf_triad_test::mete_instantiate_old()
 void gpt_cf_triad_test::mete_premiums_old()
 {
     static int     const duration =      0  ;
-    static double  const f3bft    = 120000.0;
+    static double  const f3_bft   = 120000.0;
     static double  const endt_bft = 100000.0;
     static Irc7702 const z = instantiate_old(duration);
-    z.CalculateGSP(duration, f3bft, endt_bft, endt_bft                      );
-    z.CalculateGLP(duration, f3bft, endt_bft, endt_bft, mce_option1_for_7702);
-    z.CalculateGLP(duration, f3bft, endt_bft, endt_bft, mce_option2_for_7702);
+    z.CalculateGSP(duration, f3_bft, endt_bft, endt_bft                      );
+    z.CalculateGLP(duration, f3_bft, endt_bft, endt_bft, mce_option1_for_7702);
+    z.CalculateGLP(duration, f3_bft, endt_bft, endt_bft, mce_option2_for_7702);
 }
 
 void gpt_cf_triad_test::assay_speed()
diff --git a/gpt_commutation_functions.cpp b/gpt_commutation_functions.cpp
index 43e6d8f..0007e21 100644
--- a/gpt_commutation_functions.cpp
+++ b/gpt_commutation_functions.cpp
@@ -174,9 +174,9 @@ double gpt_commfns::calculate_premium
     int const j = args.duration;
     double numerator =
           D_endt_          * args.endt_bft
-        + M_           [j] * args.f3bft
+        + M_           [j] * args.f3_bft
         + N_chg_pol_   [j]
-        + N_chg_sa_    [j] * args.chg_sa_amt
+        + N_chg_sa_    [j] * args.chg_sa_base
         + N_qab_gio_   [j] * args.qab_gio_amt
         + N_qab_adb_   [j] * args.qab_adb_amt
         + N_qab_term_  [j] * args.qab_term_amt
@@ -186,13 +186,13 @@ double gpt_commfns::calculate_premium
         ;
     double denom_tgt = glp_or_gsp ? D_net_tgt_[j] : N_net_tgt_[j];
     double z = numerator / denom_tgt;
-    if(z <= args.target)
+    if(z <= args.target_prem)
         {
         return z;
         }
 
     double denom_exc = glp_or_gsp ? D_net_exc_[j] : N_net_exc_[j];
-    return (numerator + args.target * (denom_exc - denom_tgt)) / denom_exc;
+    return (numerator + args.target_prem * (denom_exc - denom_tgt)) / 
denom_exc;
 }
 
 gpt_cf_triad::gpt_cf_triad
@@ -236,10 +236,10 @@ double gpt_cf_triad::calculate_premium
 {
     LMI_ASSERT(0 <= args.duration        );
     LMI_ASSERT(args.duration < length_   );
-    LMI_ASSERT(0.0 <= args.f3bft         );
+    LMI_ASSERT(0.0 <= args.f3_bft        );
     LMI_ASSERT(0.0 <= args.endt_bft      );
-    LMI_ASSERT(0.0 <= args.target        );
-    LMI_ASSERT(0.0 <= args.chg_sa_amt    );
+    LMI_ASSERT(0.0 <= args.target_prem   );
+    LMI_ASSERT(0.0 <= args.chg_sa_base   );
     LMI_ASSERT(0.0 <= args.qab_gio_amt   );
     LMI_ASSERT(0.0 <= args.qab_adb_amt   );
     LMI_ASSERT(0.0 <= args.qab_term_amt  );
diff --git a/gpt_commutation_functions.hpp b/gpt_commutation_functions.hpp
index 3ae59ce..49fc4e4 100644
--- a/gpt_commutation_functions.hpp
+++ b/gpt_commutation_functions.hpp
@@ -75,17 +75,17 @@ struct gpt_vector_parms
 /// differs between GLP and GSP. The 'mcenum_dbopt_7702' argument
 /// is excluded here because it's irrelevant for GSP.
 ///
-/// 'chg_sa_amt' is the base for any specified-amount load. It may
+/// 'chg_sa_base' is the base for any specified-amount load. It may
 /// differ from 'specamt', e.g., by being limited to a scalar maximum,
 /// by including a term amount, or by being set immutably at issue.
 
 struct gpt_scalar_parms
 {
     int    duration       ;
-    double f3bft          ;
+    double f3_bft         ;
     double endt_bft       ;
-    double target         ;
-    double chg_sa_amt     ;
+    double target_prem    ;
+    double chg_sa_base    ;
     double qab_gio_amt    ;
     double qab_adb_amt    ;
     double qab_term_amt   ;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]