lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6588] Refactor: move some variables outside of the loop t


From: gchicares
Subject: [lmi-commits] [6588] Refactor: move some variables outside of the loop to allow reuse (VZ )
Date: Fri, 13 May 2016 14:02:32 +0000 (UTC)

Revision: 6588
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6588
Author:   chicares
Date:     2016-05-13 14:02:32 +0000 (Fri, 13 May 2016)
Log Message:
-----------
Refactor: move some variables outside of the loop to allow reuse (VZ)

Modified Paths:
--------------
    lmi/trunk/group_quote_pdf_gen_wx.cpp

Modified: lmi/trunk/group_quote_pdf_gen_wx.cpp
===================================================================
--- lmi/trunk/group_quote_pdf_gen_wx.cpp        2016-05-13 13:59:23 UTC (rev 
6587)
+++ lmi/trunk/group_quote_pdf_gen_wx.cpp        2016-05-13 14:02:32 UTC (rev 
6588)
@@ -778,6 +778,11 @@
 
     bool const is_composite = ledger.is_composite();
 
+    // Some values which will be used more than once in the loop below.
+    double const basic_face_amount = invar.SpecAmt.at(year);
+    double const suppl_face_amount = invar.TermSpecAmt.at(year);
+    double const total_face_amount = basic_face_amount + suppl_face_amount;
+
     row_data rd;
     for(int col = 0; col < e_col_max; ++col)
         {
@@ -811,11 +816,10 @@
                 break;
             case e_col_basic_face_amount:
                 {
-                double const z = invar.SpecAmt.at(year);
-                rd.values[col] = '$' + ledger_format(z, f0);
+                rd.values[col] = '$' + ledger_format(basic_face_amount, f0);
                 if(is_composite)
                     {
-                    totals_.total(col, z);
+                    totals_.total(col, basic_face_amount);
                     }
                 }
                 break;
@@ -831,11 +835,10 @@
                 break;
             case e_col_supplemental_face_amount:
                 {
-                double const z = invar.TermSpecAmt.at(year);
-                rd.values[col] = '$' + ledger_format(z, f0);
+                rd.values[col] = '$' + ledger_format(suppl_face_amount, f0);
                 if(is_composite)
                     {
-                    totals_.total(col, z);
+                    totals_.total(col, suppl_face_amount);
                     }
                 }
                 break;
@@ -851,11 +854,10 @@
                 break;
             case e_col_total_face_amount:
                 {
-                double const z = invar.SpecAmt.at(year) + 
invar.TermSpecAmt.at(year);
-                rd.values[col] = '$' + ledger_format(z, f0);
+                rd.values[col] = '$' + ledger_format(total_face_amount, f0);
                 if(is_composite)
                     {
-                    totals_.total(col, z);
+                    totals_.total(col, total_face_amount);
                     }
                 }
                 break;




reply via email to

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