Skip to content

fix: preserve XIRR under cash-flow scaling and avoid residual product overflow - #68

Open
Altairpaca wants to merge 2 commits into
mainfrom
fix/xirr-currency-scale-invariance
Open

Altairpaca wants to merge 2 commits into
mainfrom
fix/xirr-currency-scale-invariance

Conversation

@Altairpaca

@Altairpaca Altairpaca commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Fixes #67.

Minimal numerical correction

Use exact zero or the existing dimensionless rate-bracket tolerance for convergence. Compare signs without multiplying residuals. Keep the existing bracket domain/expansion, 160-step bisection limit, ACT/365 convention and missing-sign behavior.

Regression evidence

The exact source blob 42f949891b3c7b503d1962337c85edc2bb835ef3 from base 149645a6a5ef97dea99458bf036d1b92e223907c was materialized and Git-hash checked. Eight isolated xirr tests produce six failing subtests and one error before the fix; all eight pass after it. The isolated runner supplies the existing finite Decimal parser and does not exercise ledger integration.

Full repository CI run 34685592956 passed on Python 3.12 and 3.13 for head a4416aa9ba8c8094d7bf70cad3318cc88fce25fa. The inspected 3.13 log reports 237 passed, 4 skipped, 12 subtests passed, plus successful compilation, whitespace and distribution builds. Checkout was merge preview de3ae6dee521d93830df9ac2fa60a2a5c68d49d8 against the base above. No source changed after verification. Ready for review; skipped tests are not counted as executed acceptance.

Compatibility / scope

This corrects wrong rates for small amounts and sign-comparison range failures; it does not claim to solve all Decimal extremes, enumerate multiple IRRs, change no-bracket conventions, add a feature milestone, or measure portfolio performance. Existing real-host and provider gates are unaffected.

Copy link
Copy Markdown
Owner Author

Full-suite verification for head a4416aa9ba8c8094d7bf70cad3318cc88fce25fa: CI run 34685592956 passed on Python 3.12 and 3.13. The inspected 3.13 job checked merge preview de3ae6dee521d93830df9ac2fa60a2a5c68d49d8 (this head into base 149645a6a5ef97dea99458bf036d1b92e223907c) and reports 237 passed, 4 skipped, 12 subtests passed. Compilation, whitespace, wheel and sdist checks passed too. The skipped tests are not counted as executed acceptance; no real-host/provider gate is cleared by this patch. No source change followed this run.

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.

XIRR stopping condition depends on currency scale; residual sign products can overflow

1 participant