Skip to content

Add regression corpus from numpy-financial and java-xirr issues - #25

Merged
tubedude merged 1 commit into
mainfrom
regression-issue-corpus
Jul 5, 2026
Merged

Add regression corpus from numpy-financial and java-xirr issues#25
tubedude merged 1 commit into
mainfrom
regression-issue-corpus

Conversation

@tubedude

@tubedude tubedude commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Recreates cash flows from closed issues on numpy-financial (Python) and java-xirr (Java) — cases where those libraries returned a wrong rate, raised, or failed to converge — and pins finance-elixir's behaviour so a future solver change can't regress them.

numpy-financial (Python)

Issue Their result finance-elixir
#44 negative final flow past the 9th -0.9997 (garbage) 1.0043 — genuine ~100% root
#46 outlay in the second period 75.33 (7533%) -0.557 — genuine root
#98 multiple roots wrong root -0.0677 — genuine root
#15 vanishing flows LinAlgError crash :did_not_converge (root is below the -99.9999% floor)

java-xirr (Java)

Issue Their result finance-elixir
#17 overflow, 31 flows OverflowException -0.80991843 = Google Sheets to 8 dp
#14 nonconvergence exception -0.72463661 = Excel to 8 dp
#12 nonconvergence exception 0.1884 = reporter's expected 18.84%
#5 yield below -0.64 exception -0.764 genuine root
#7 zero derivative ArithmeticException -0.9999 near-total-loss root
#10 high-value PE fund NonconvergenceException 0.1384 genuine root
#16 magnitudes to 1e9 NonconvergenceException -0.5748 genuine root

Where an authoritative Excel/Sheets value exists, the test asserts it exactly. For the rest, a scale-relative helper verifies the NPV is negligible next to the largest flow — a near--100% or 1e9-magnitude root leaves a non-zero absolute NPV even though it's a real root, so those are solved at precision: 10 and checked relatively.

Test-only; no library or version change. 244 tests, credo/dialyzer clean, 100% coverage.

🤖 Generated with Claude Code

Cash flows from closed issues where those libraries returned a wrong rate,
raised, or failed to converge, each now pinned against finance-elixir:

- numpy-financial: #44 (negative final flow), #46 (second-period outlay),
  #98 (multiple roots), #15 (vanishing flows that raised LinAlgError).
- java-xirr: #17 and #14 match Google Sheets / Excel to 8 decimals, #12
  recovers the reporter's 18.84%, and #5/#7/#10/#16 resolve series that
  raised NonconvergenceException, zero-derivative, or overflow.

Roots are checked scale-relative (NPV negligible next to the largest flow),
since a near--100% or 1e9-magnitude root leaves a non-zero absolute NPV.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AVibXT2w1dEdVtMHqffFKn
@tubedude
tubedude merged commit 6d1a89b into main Jul 5, 2026
4 checks passed
@tubedude
tubedude deleted the regression-issue-corpus branch July 5, 2026 19:41
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — regression-issue-corpus into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants