lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 8ffc9d2 10/10: Calculate 7702 'ig' more caref


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 8ffc9d2 10/10: Calculate 7702 'ig' more carefully
Date: Mon, 1 Mar 2021 09:39:24 -0500 (EST)

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

    Calculate 7702 'ig' more carefully
    
    For product 'sample2xyz', the monthly interest rate used for discounting
    DB in the NAAR calculation is:
      0.00246626977230360007812 // DB_GuarInt transformed as (i upper 12)/12
      0.00246627000000000000737 // DB_NaarDiscount (rounded)
    The greater of the two values must be used for 7702.
---
 i7702.cpp | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/i7702.cpp b/i7702.cpp
index 465316b..b5e5953 100644
--- a/i7702.cpp
+++ b/i7702.cpp
@@ -49,6 +49,7 @@ i7702::i7702
 
     std::vector<double> guar_int;
     database_.query_into(DB_GuarInt, guar_int);
+    std::vector<double> const contractual_guar_int = guar_int;
 
     // For 7702 purposes, the rate guaranteed by the contract is the
     // highest rate on any potential path, at each duration; thus,
@@ -117,8 +118,8 @@ i7702::i7702
     // as seen in his formula (1):
     //   [0V + P - Q(1/(1 + ig) - OV - P)] (1 + ic) = 1V
     // where it is the monthly (i upper 12 over 12) equivalent of
-    // the annual 'guar_int' rate above. Specifying a discount based
-    // on any other rate is presumably an error.
+    // the annual 'contractual_guar_int' rate above. Specifying a
+    // discount based on any other rate is presumably an error.
     //
     // In lmi's product database, DB_GuarInt is i. DB_NaarDiscount is
     // (i upper 12)/12, rounded iff the contract specifies a rounded
@@ -140,14 +141,21 @@ i7702::i7702
     std::vector<double> contractual_naar_discount;
     database_.query_into(DB_NaarDiscount, contractual_naar_discount);
     bool const no_naar_discount = zero == contractual_naar_discount;
+    std::vector<double> theoretical_naar_discount(database_.length(), 0.0);
+    theoretical_naar_discount +=
+        apply_unary(i_upper_12_over_12_from_i<double>(), contractual_guar_int);
 
     std::vector<double> diff(database_.length(), 0.0);
-    diff += fabs
-        ( contractual_naar_discount
-        - apply_unary(i_upper_12_over_12_from_i<double>(), guar_int)
-        );
+    diff += fabs(contractual_naar_discount - theoretical_naar_discount);
     minmax<double> const mm(diff);
     constexpr double tolerance {0.0000001};
     LMI_ASSERT(no_naar_discount || mm < tolerance);
-    ig_ = no_naar_discount ? zero : gross_;
+
+    std::vector<double> operative_naar_discount(database_.length(), 0.0);
+    operative_naar_discount +=
+        Max
+            (apply_unary(i_upper_12_over_12_from_i<double>(), statutory7702i)
+            ,Max(contractual_naar_discount, theoretical_naar_discount)
+            );
+    ig_ = no_naar_discount ? zero : operative_naar_discount;
 }



reply via email to

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