lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master a91cbc67: Make two comparisons work even for


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a91cbc67: Make two comparisons work even for x87
Date: Wed, 11 May 2022 10:52:42 -0400 (EDT)

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

    Make two comparisons work even for x87
    
    Replacing a 7PP-rate table to address this anomaly:
    
      https://lists.nongnu.org/archive/html/lmi/2022-05/msg00006.html
    | Table #10 specifies 8 decimals, but 17 were necessary.
    
    caused MEC year to change from 12 (correct) to 3 (incorrect) for one
    test case.
    
    Changing the if-conditional from "X < Y" to "X < Y && X ≉ Y":
      if(CumSevenPP < CumPmts && !materially_equal(CumSevenPP, CumPmts))
    fixed that test case. However, that fix caused the assertion to fire for
    a second test case; changing it from "X ≤ Y" to "X ≤ Y || X ≈ Y":
      CumPmts <= CumSevenPP || materially_equal(CumSevenPP, CumPmts)
    prevented it from firing, and resolved a latent problem with that test
    case. Its annual premium amount is given as an integral number of
    dollars that is notionally the same as the 7PP, but not equal:
       100000 specified amount
      0.03480 tabular 7PP rate, specified with five-digit precision
         3479.99999999999954525 CumSevenPP in class Irc7702A
         3480                   CumPmts    in class Irc7702A
    Formerly, that became a MEC in year zero, when CumPmts > CumSevenPP.
    Now, it doesn't; instead, it becomes a MEC in the ninth year, when a
    ninth seven-pay premium is paid, and that seems to be correct. This
    causes its DCV to change enormously in the ninth year (that is, year
    number 8 of {0,1,2,3,4,5,6,7,8}), which also seems to be correct. It
    is appropriate to change these values, which had been obviously wrong
    for a couple of decades. However, this reveals a different problem,
    in the PDF output:
      InitSevenPayPrem==3479.98999999999978172 [double]
           InitTgtPrem==348000                 [currency]
              InitPrem==348000                 [currency]
    Thus, 7PP is unrounded within class Irc7702A, where it is virtually
    equal to the actual $3480 payment, so it's not a MEC; but the PDF
    shows 7PP rounded to 3479.99, according to which the contract would
    be a MEC. Using class currency almost everywhere, though not yet for
    taxation because that will be difficult, makes the discrepancy plain:
    the target premium in this case is defined to be the 7PP.
    
    System-test results from 2019-09-13 (the oldest readily available) show
    comparable values, before currency-ization:
      InitSevenPayPrem==3479.98999999999978172
           InitTgtPrem==3479.98999999999978172
              InitPrem==3480
    This historical result shows the same anomaly, along with another that
    has since been corrected: now, InitTgtPrem and InitPrem are the same.
    The remaining anomaly is that InitSevenPayPrem is shown as one cent
    less than its intended value of
      100000 * 0.03480
    which is taken as
      100000 * (3480 / 100000) = $3,480.00 exactly.
    It seems wise to address that anomaly in a separate commit.
---
 ihs_irc7702a.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ihs_irc7702a.cpp b/ihs_irc7702a.cpp
index 35a1abec..55b2d232 100644
--- a/ihs_irc7702a.cpp
+++ b/ihs_irc7702a.cpp
@@ -557,7 +557,12 @@ double Irc7702A::MaxNonMecPremium
         {
         if(TestPeriodDur < TestPeriodLen)
             {
-            LMI_ASSERT(CumPmts <= CumSevenPP);
+            // Weird condition--see:
+            //   
https://lists.nongnu.org/archive/html/lmi/2022-05/msg00006.html
+            LMI_ASSERT
+                (  CumPmts <= CumSevenPP
+                || materially_equal(CumSevenPP, CumPmts)
+                );
             state_.Q6_max_non_mec_prem = RoundNonMecPrem(CumSevenPP - CumPmts);
             return state_.Q6_max_non_mec_prem;
             }
@@ -709,7 +714,9 @@ double Irc7702A::UpdatePmt7702A
             }
         */
         CumPmts += a_Payment;
-        if(CumSevenPP < CumPmts)
+        // Weird conditional--see:
+        //   https://lists.nongnu.org/archive/html/lmi/2022-05/msg00006.html
+        if(CumSevenPP < CumPmts && !materially_equal(CumSevenPP, CumPmts))
             {
             IsMec = true;
 /* TODO ?? TAXATION !! Reenable after testing.



reply via email to

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