fix(lib): CLI-side XIRR uses Excel's 365-day basis (was 365.25)#63
Merged
Conversation
The engine-side computeXIRR was fixed to the 365-day basis in PR #62; lib/irr.mjs (used by ete carry --solve-life and scenario IRR fallbacks) still divided by 365.25, drifting every solved rate by ~1e-5 per leap span. Negative-controlled leap-span case added to tests/lib/test-lib.mjs (RED on 365.25 with the predicted value, GREEN on 365). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 10, 2026
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.
Follow-up to #62 (which fixed the engine-side
computeXIRRto the 365-day basis):lib/irr.mjs— the CLI-side XIRR used byete carryIRR-solved life and scenario fallbacks — still divided by 365.25.tests/lib/test-lib.mjs: −100 on 2020-01-01 → +110 on 2021-01-01 (366 days) solves to1.1^(365/366) − 1; the old basis lands ~3.6e-5 away, outside the 1e-6 gate. RED pre-fix with exactly the 365.25-basis value, GREEN post-fix.npm testgreen (45/45 lib, 132/132 use-case suite).🤖 Generated with Claude Code