[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f786840 2/2: Avoid catastrophic cancellation
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f786840 2/2: Avoid catastrophic cancellation |
Date: |
Fri, 11 Sep 2020 15:43:30 -0400 (EDT) |
branch: master
commit f7868401e65436296a442e64a1bd3bda27782887
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Avoid catastrophic cancellation
An experimental modification elsewhere unexpected caused the necessary
premium to be -7.10543e-17, which violated assertions downstream (at
inception, for a case with a 1035 exchange).
---
ihs_avmly.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index 22b1cc5..1d1466e 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -202,7 +202,7 @@ void AccountValue::DoMonthDR()
gross_1035 = External1035Amount + Internal1035Amount;
}
double necessary_premium = std::min
- (GrossPmts[Month] - gross_1035
+ (material_difference(GrossPmts[Month], gross_1035)
,max_necessary_premium
);
double unnecessary_premium = material_difference