Skip to content

Add FVSCHEDULE financial function#73

Closed
BrianHung wants to merge 1 commit into
mainfrom
financial-pr1-fvschedule
Closed

Add FVSCHEDULE financial function#73
BrianHung wants to merge 1 commit into
mainfrom
financial-pr1-fvschedule

Conversation

@BrianHung

@BrianHung BrianHung commented Feb 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • implement FVSCHEDULE with schedule parsing and validation
  • wire into function dispatch and static analysis
  • add tests and docs
  • add parser fallback so FVSCHEDULE parses without locale data

Test plan

  • cargo test --package ironcalc_base fvschedule

Note

Medium Risk
Adds a new financial function and wires it through parsing, static analysis, and function dispatch, which can affect formula interpretation and evaluation in edge cases. Logic is straightforward and covered by targeted tests, keeping overall risk moderate.

Overview
Implements Excel-compatible FVSCHEDULE(principal, schedule) end-to-end: evaluation compounds principal across a vector/range of rates with validation (rate > -1) and error handling for invalid/overflow results.

Wires FVSCHEDULE into the engine’s function enum/dispatch and static analysis (expects a scalar + vector), and adds a parser fallback so _xlfn.FVSCHEDULE is recognized even without locale/language function metadata.

Adds unit tests for computation, argument-count errors, non-numeric schedule handling, and rate edge cases, and updates docs to mark FVSCHEDULE as available with a stub documentation page.

Written by Cursor Bugbot for commit aa964af. Configure here.

Implements FVSCHEDULE with schedule parsing and validation, wires it into
function dispatch and static analysis, and adds dedicated tests and docs.
Includes a parser fallback so FVSCHEDULE formulas parse without locale data.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

result *= 1.0 + rate;
}
if result.is_infinite() {
return CalcResult::new_error(Error::DIV, cell, "Division by 0".to_string());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong error type for infinite result in FVSCHEDULE

Low Severity

The fn_fvschedule function returns Error::DIV with message "Division by 0" when result.is_infinite(), but FVSCHEDULE only performs multiplication operations. An infinite result from multiplication is an overflow, not division by zero. Other functions in the codebase (such as in bessel.rs and complex.rs) correctly use Error::NUM for infinite/NaN results from non-division operations.

Fix in Cursor Fix in Web

kind: Function::Fvschedule,
args,
};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded FVSCHEDULE bypasses locale data pattern

Low Severity

FVSCHEDULE has a hardcoded parser fallback that bypasses the standard language.functions.lookup() pattern used by all other functions. This check also redundantly calls name.trim_start_matches("_xlfn.") which was already called on line 783. The proper fix would be to add fvschedule to the language data structure in base/src/language/mod.rs.

Fix in Cursor Fix in Web

@BrianHung BrianHung closed this Feb 3, 2026
@BrianHung BrianHung deleted the financial-pr1-fvschedule branch February 3, 2026 18:42
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.

1 participant