1.0.0 — 2026-07-04
A complete rewrite of the library. Breaking changes — some return values differ from 0.x because intermediate rounding was removed and the solver was replaced, and errors are now atoms rather than strings.
Rate of return
xirr/1,2,3andxirr!— internal rate of return for dated cash flows, given as{date, amount}pairs or two parallel lists. Dates may beDatestructs or{year, month, day}tuples.irr/1,2andirr!— internal rate of return for periodic (equally spaced) flows.mirr/3,4andmirr!— modified internal rate of return.- Newton-Raphson solver with an analytic derivative, a bracketing bisection fallback, and a hard iteration cap.
Present / future value
xnpv/2,3andxnpv!— net present value of dated cash flows.npv/2,3andnpv!— net present value of periodic flows. The first amount sits at period 0 (sonpv(irr(a), a) ≈ 0), which differs from spreadsheetNPV(first amount at period 1).
Time value of money
fv/5,pv/5,pmt/5,nper/5,rate/6and their!variants — solve the annuity equation for one unknown, with annuity-due (type: 1) support.
Depreciation
sln/3,syd/4,ddb/5,db/5and their!variants — straight-line, sum-of-years'-digits, double-declining and fixed-declining depreciation.
Amounts and options
- Amounts may be integers, floats, or
Decimalvalues (via the optionaldecimaldependency); results are always floats. - Options (
:guess,:tolerance,:max_iterations,:precision) are validated withnimble_options; unknown keys and out-of-type values raise.
Removed
- The
timexruntime dependency (now uses the standard-libraryDate). - The
spawn_link-per-cash-flow "parallel" mapping, which was slower and unsafe.
Tooling
- Requires Elixir
~> 1.18; tested on Elixir 1.18/OTP 27 and 1.20/OTP 29. - Travis CI replaced with GitHub Actions.