Add function XIRR#1701
Open
sequba wants to merge 3 commits into
Open
Conversation
✅ Deploy Preview for hyperformula-dev-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
Task linked: HF-76 Implement function XIRR |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7827c1e. Configure here.
Performance comparison of head (36c1465) vs base (4e302ff) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1701 +/- ##
===========================================
+ Coverage 97.14% 97.15% +0.01%
===========================================
Files 176 176
Lines 15333 15404 +71
Branches 3390 3409 +19
===========================================
+ Hits 14895 14966 +71
Misses 438 438
🚀 New features to boost your workflow:
|
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.

Summary
Implements the Excel
XIRRfunction (HF-76).XIRR(Values, Dates[, Guess])toFinancialPlugin— returns the internal rate of return for a schedule of cash flows that is not necessarily periodicGuessdefaults to0.1; solver uses Newton–Raphson with day-based discounting on a 365-day year0, and returns#NA!for single-cell or scalar argumentsXIRRin all language packs, updatesbuilt-in-functions.mdandCHANGELOG.mdfunction-xirr.spec.ts)Test plan
npm test— lint + unit + browserTypes of changes
Note
Low Risk
Additive built-in function in FinancialPlugin with localized names and documentation; no changes to auth, persistence, or core engine APIs.
Overview
Adds Excel-compatible
XIRR(Values, Dates[, Guess])for irregular cash-flow schedules, alongside existingIRRandXNPV.Implementation lives in
FinancialPlugin: aligned value/date ranges are sanitized (empty value cells →0, errors propagated, non-numeric →#VALUE!), with checks for length match, at least two flows, mixed signs, valid dates, andGuess > -1. The rate is solved with Newton–Raphson on day-based discounting using a 365-day year, including overshoot clamping when the iterate would fall at or below -1.XIRRis registered in all language packs, documented inbuilt-in-functions.md, noted inCHANGELOG.md, andAGENTS.mdgains a reminder to keep PR descriptions up to date.Reviewed by Cursor Bugbot for commit 36c1465. Bugbot is set up for automated code reviews on this repo. Configure here.