Skip to content

BusinessMath 2.12.0 — The bindable category, verified

Choose a tag to compare

@jpurnell jpurnell released this 06 Sep 01:48

v2.12.0 — the bindable category, verified

86 Excel functions were marked bindable: BusinessMath computed the quantity and
nothing bound a name to it. That also meant none had ever been compared to an
independent implementation, only to its own definition. 160 cases across 43 of them
now have been.

Four defects were sitting in shipped code with green tests over them.

interestPayment charged a full period's interest on an annuity due's first payment,
which happens at time zero before any interest has accrued. On a 200,000 mortgage
that made the first year's CUMIPMT 9% too high and its CUMPRINC 41% too low. The
annuity-due correction was guarded by period > 1, so the one period needing it
most received none.

xnpv and xirr discounted by elapsed seconds over 365 days where a spreadsheet counts
whole days — the same mistake fixed in 2.11.1, in a second place. xnpv now delegates
to DayCountConvention.actual365 rather than repeating the arithmetic.

Added, from Microsoft's definitions rather than adapted from what was here: PRICE,
YIELD, DURATION and MDURATION on a CouponPeriod exposing COUPPCD, COUPNCD, COUPDAYBS,
COUPDAYSNC, COUPDAYS and COUPNUM; EFFECT and RRI; STANDARDIZE, TREND, LOGEST, GROWTH,
RANK.EQ, RANK.AVG and PERCENTRANK.INC.

Bond.price(yield:) was not the right basis for PRICE. It discounts a schedule it
builds itself, and the two differ whenever settlement falls between coupon dates —
only one of them answers =PRICE(...). The new family matched Excel's own cached
values on the first run, including the one case of twenty-eight that discriminates on
the day count: a zero-coupon bond settling mid-period across a year boundary, at
58.771794240682887.

The pattern matters more than any single defect. Every one of the four was in code
with passing tests, and every one was found the same way — by comparing against an
independent implementation. A test written from the same understanding as the code
confirms the understanding, not the code.

6,898 tests / 611 suites. quality-gate --check all: 45 of 45, 0 errors, 0 warnings.