lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5223] Fix defect introduced 20110523T1058Z (while fixing


From: Greg Chicares
Subject: [lmi-commits] [5223] Fix defect introduced 20110523T1058Z (while fixing another defect)
Date: Wed, 20 Jul 2011 22:31:32 +0000

Revision: 5223
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5223
Author:   chicares
Date:     2011-07-20 22:31:30 +0000 (Wed, 20 Jul 2011)
Log Message:
-----------
Fix defect introduced 20110523T1058Z (while fixing another defect)

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

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2011-07-07 21:38:18 UTC (rev 5222)
+++ lmi/trunk/ChangeLog 2011-07-20 22:31:30 UTC (rev 5223)
@@ -28093,3 +28093,8 @@
   install_wx.make
 Upgrade to wx-2.9.2 .
 
+20110720T2231Z <address@hidden> [649]
+
+  premium_tax.cpp
+Fix defect introduced 20110523T1058Z (while fixing another defect).
+

Modified: lmi/trunk/premium_tax.cpp
===================================================================
--- lmi/trunk/premium_tax.cpp   2011-07-07 21:38:18 UTC (rev 5222)
+++ lmi/trunk/premium_tax.cpp   2011-07-20 22:31:30 UTC (rev 5223)
@@ -266,8 +266,26 @@
 /// DATABASE !! The '.strata' files ought to differentiate tiered
 /// premium-tax load paid by customer from rate paid by insurer.
 ///
-/// An assertion ensures that either tiered or non-tiered premium-tax
+/// Assertions ensure that either tiered or non-tiered premium-tax
 /// load is zero.
+///
+/// Tiered premium tax is always greatest on the first dollar. In the
+/// case of modal premiums, the incidence of taxation is therefore
+/// front loaded in the general case; this must be reflected because
+/// to do otherwise would overstate account value.
+///
+/// Tax is calculated separately for the premium-tax state and the
+/// state of domicile, and the greater amount usually applies because
+/// of retaliation. If the rate is tiered in either state, then the
+/// incremental tax on any modal premium is the difference between
+/// year-to-date tax after and before the payment, with due regard to
+/// retaliation; no simpler formula can be correct in the general
+/// case. However, catastrophic cancellation occurs all too easily
+/// with this formula--for example, when a MEC is avoided by reducing
+/// one modal premium to an amount orders of magnitude lower than the
+/// year-to-date premium--so it is to be avoided where demonstrably
+/// unnecessary. A simple scalar calculation that disregards history,
+/// iff correct, is more accurate.
 
 double premium_tax::calculate_load(double payment, stratified_charges const& 
strata)
 {
@@ -301,15 +319,20 @@
 
     ytd_taxable_premium_ += payment;
 
-    // 'x' is more robust, though more prone to roundoff error than
-    // 'y', so 'y' is preferred iff they're materially equal.
     double ytd_tax_reflecting_retaliation = std::max
         (ytd_load_in_tax_state_
         ,ytd_load_in_domicile_
         );
     double x = std::max(0.0, ytd_tax_reflecting_retaliation - ytd_load_);
     double y = std::max(tax_in_tax_state, tax_in_domicile);
-    double z = materially_equal(x, y) ? y : x;
+    bool no_tiering = !is_tiered_in_tax_state_ && !is_tiered_in_domicile_;
+    // SOMEDAY !! Perhaps something like
+    //   double k = 10.0; // Some number somewhat greater than unity.
+    //   double t = k * DBL_EPSILON * ytd_taxable_premium_ / payment;
+    //   double z = no_tiering || materially_equal(x, y, t) ? y : x;
+    // would achieve better accuracy; but that must not be attempted
+    // without thorough unit testing.
+    double z = no_tiering || materially_equal(x, y) ? y : x;
     ytd_load_ += z;
     return z;
 }




reply via email to

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