lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Question about "Numeric summary" logic


From: Greg Chicares
Subject: Re: [lmi] Question about "Numeric summary" logic
Date: Mon, 31 Jul 2017 03:26:15 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 2017-07-30 23:27, Vadim Zeitlin wrote:
> On Sun, 30 Jul 2017 22:51:37 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> int Ledger::GetMaxLength() const
> GC> ...
> GC>     // For all ledgers in the map, find the longest duration that must
> GC>     // be printed (until the last one lapses).
> GC> ...
> GC>     for(auto const& i : l_map_rep)
> GC>         {
> GC>         max_length = std::max(max_length, i.second.LapseYear);
> GC>         }
> GC> 
> GC> which iterates implicitly over exactly the bases actually used.

We don't want to print any more data rows after the policy has
lapsed on all bases. That's why we want this variety of maximum
duration.

There's another variety: the maximum duration that can possibly
be reached, which is the "maturity" age (or, synonymously, the
"endowment" age) minus the age at policy inception. That's
what's calculated here:

>  Thanks, I did see this but assumed that I shouldn't use it because of this
> comment in xml_ledger_io.cpp:
> 
>       // GetMaxLength() is max *composite* length.
>       //    int max_length = GetMaxLength();
>           double MaxDuration = ledger_invariant_->EndtAge - 
> ledger_invariant_->Age;
> 
> Now I realize that I should have asked about why does XSLT use
> max-lapse-year instead of MaxDuration and whether MaxDuration as computed
> here can be different from GetMaxLength() for non-composite illustrations
> (I haven't looked at what happens in the composite case yet...).

Even the C++ code is really old. The names of its variables and
functions are too often ambiguous, as here. As explained above,
there's more than one "maximum" of interest.

The maturity duration (EndtAge - Age) is the actual number of
elements in the typical vectors in class Ledger. It's the argument
we'd use to vector::reserve() when initializing these vectors.
If you're age 45 when your policy is issued, and the maturity age
is 100, then these vectors have 55 elements, and any index in the
interval [0,55) has defined behavior.

The longest lapse duration on any basis is the number of rows we
print for all bases. (Or maybe it's one plus that number. Another
way of explaining this is that we want to truncate rows that would
contain nothing but zeros--which is useful as a visual check, but
would be a terrible algorithm.)

I'm hoping soon to revise class FlatTextLedgerPrinter so that it
can serve as a simple and reliable model for this PDF work. I've
hesitated even to mention it because I've found flaws in it. If
I can remove those flaws, it should answer not only your current
questions but also potential ones you haven't asked yet.



reply via email to

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