Add regression corpus from numpy-financial and java-xirr issues - #25
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
-0.9997(garbage)1.0043— genuine ~100% root75.33(7533%)-0.557— genuine root-0.0677— genuine rootLinAlgErrorcrash:did_not_converge(root is below the -99.9999% floor)java-xirr (Java)
OverflowException-0.80991843= Google Sheets to 8 dp-0.72463661= Excel to 8 dp0.1884= reporter's expected 18.84%-0.764genuine rootArithmeticException-0.9999near-total-loss rootNonconvergenceException0.1384genuine rootNonconvergenceException-0.5748genuine rootWhere 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: 10and checked relatively.Test-only; no library or version change. 244 tests, credo/dialyzer clean, 100% coverage.
🤖 Generated with Claude Code