lmi-commits
[Top][All Lists]

## [lmi-commits] [lmi] master 53a5817 1/6: Simplify logic

 From: Greg Chicares Subject: [lmi-commits] [lmi] master 53a5817 1/6: Simplify logic Date: Wed, 8 Jul 2020 20:18:27 -0400 (EDT)

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

Simplify logic

The survival limit is a single choice from four elements. For reports,
it's translated to three booleans, one for every choice except the
default (no limit). To ascertain the choice for a composite, there is
no more reasonable method than to pick the last cell's choice. AND-ing
the booleans was a complicated way of achieving the same result.

How should an (integer) age or duration limit be composited? Arguments
could be made for using the highest, or the lowest, but both are wrong
from some point of view, and both introduce the possibility of anomalies
(age 70, dying at age 60, e.g.; or age 80, dying at duration 50, on a
product that matures at age 100). Picking the last cell's value is
simple and robust.
---
ledger_invariant.cpp | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -501,9 +501,9 @@ void LedgerInvariant::Init()
EndtAge                    = 100;
NoLongerIssued             = false;
AllowGroupQuote            = true;
-    SurviveToExpectancy        = true;
-    SurviveToYear              = true;
-    SurviveToAge               = true;
+    SurviveToExpectancy        = false;
+    SurviveToYear              = false;
+    SurviveToAge               = false;
SurvivalMaxYear            = 0;
SurvivalMaxAge             = 0;
InforceYear                = Length;
@@ -674,12 +674,11 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant
UseExperienceRating        = UseExperienceRating   ||

-    SurviveToExpectancy        = SurviveToExpectancy   &&
-    SurviveToYear              = SurviveToYear         &&
-    SurviveToAge               = SurviveToAge          &&
-    LMI_ASSERT(SurviveToExpectancy + SurviveToYear + SurviveToAge <= 1);
-    SurvivalMaxYear            = std::max(SurvivalMaxYear,
-    SurvivalMaxAge             = std::max(SurvivalMaxAge ,