lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6157] Increase output precision


From: Greg Chicares
Subject: [lmi-commits] [6157] Increase output precision
Date: Mon, 30 Mar 2015 15:59:21 +0000

Revision: 6157
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6157
Author:   chicares
Date:     2015-03-30 15:59:20 +0000 (Mon, 30 Mar 2015)
Log Message:
-----------
Increase output precision

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/custom_io_1.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-03-28 12:52:24 UTC (rev 6156)
+++ lmi/trunk/ChangeLog 2015-03-30 15:59:20 UTC (rev 6157)
@@ -35978,3 +35978,8 @@
   mvc_controller.cpp
 Show tabbed-dialog dimensions if requested.
 
+20150330T1559Z <address@hidden> [516]
+
+  custom_io_1.cpp
+Increase output precision.
+

Modified: lmi/trunk/custom_io_1.cpp
===================================================================
--- lmi/trunk/custom_io_1.cpp   2015-03-28 12:52:24 UTC (rev 6156)
+++ lmi/trunk/custom_io_1.cpp   2015-03-30 15:59:20 UTC (rev 6157)
@@ -308,6 +308,18 @@
 
 /// Write custom output for a particular customer.
 ///
+/// Rounding rationale: For interest rates, general industry practice
+/// is to use eight decimals (e.g., 3% = 0.03000000, or 300.0000 bp)
+/// at most. The other quantities written here are typically treated
+/// as real-world currency amounts, and accordingly rounded to whole
+/// cents each month. It seems better to write values rounded this way
+/// than to give all possible precision, because the difference would
+/// be false precision (e.g., 434.9999999999999 instead of 435.00).
+/// Fixed point is preferred for uniformity, so that a value of zero
+/// in a two-decimal column is shown as "0.00"; "0" would convey the
+/// same information in less space, but would use a visibly different
+/// format than "123.45" in another row of the same column.
+///
 /// Assumptions:
 ///   values are all as of EOY
 ///   "interest earned" is net interest credited, net of any spread
@@ -363,11 +375,13 @@
     for(int j = 0; j < max_duration; j++)
         {
         os
-            << std::setprecision(0)
+            << std::setprecision(2)
             <<        Curr_.AcctVal        [j]
             << ',' << Curr_.CSVNet         [j]
             << ',' << Curr_.EOYDeathBft    [j]
+            << std::setprecision(4)
             << ',' << Curr_.AnnGAIntRate   [j] * 10000.0 // 'IntRate' in bp.
+            << std::setprecision(2)
             << ',' << Curr_.NetIntCredited [j]
             << ',' << Curr_.COICharge      [j]
             << ',' << Curr_.SpecAmtLoad    [j]           // 'MiscFees' = spec 
amt load.




reply via email to

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