Repository navigation
Add ACCRINTM, DISC, INTRATE, PRICEDISC, RECEIVED and YIELDDISC functions - #1799
Tobiadefami wants to merge 6 commits into
Conversation
DateTimeHelper.dayCountByBasis(startDate, endDate, basis) returns the day count and the days in the year for day-count bases 0-4. Basis 0 applies toBasisUS to copies of the dates, basis 1 uses yearLengthForBasis, and basis 4 uses toBasisEU. YEARFRAC now returns dayCount / yearDays from the helper. Its results are unchanged. DAYS360 keeps its own days360Core and is not touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nctions Six financial functions for discounted and interest-at-maturity securities, built on DateTimeHelper.dayCountByBasis. - Every argument is a SCALAR and is converted in the method, so booleans and the empty text give #VALUE! and invalid arguments are reported in Excel's order (dates, basis, then the amounts for the DISC-like functions; left to right for ACCRINTM). - Basis is truncated, but a negative basis is #NUM!, as in Excel. - Dates are truncated; dates outside the supported range give #NUM!. - The arithmetic follows the operation order that reproduces Excel's results to the 15th significant digit. - An empty or omitted ACCRINTM par is 1000. Excel rejects the 3-argument form; this is added to the list of differences. Adds catalogue entries, names in all language packs and a changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Tobiadefami thanks for the pull request. No CLA step needed here — our records show you signed the Contributor License Agreement on 2026-07-31. That signature came from our previous signing form and has been carried over, so there is nothing for you to re-sign. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 3ec6b6e | Commit Preview URL Branch Preview URL |
Oct 09 2026, 08:49 PM |
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.
Reviewed by Cursor Bugbot for commit b3989ed. Configure here.
| {argumentType: FunctionArgumentType.SCALAR, defaultValue: 1000, emptyAsDefault: true}, | ||
| {argumentType: FunctionArgumentType.SCALAR, defaultValue: 0}, | ||
| ], | ||
| }, |
There was a problem hiding this comment.
New functions omit result number types
Low Severity
DISC, INTRATE, and YIELDDISC omit returnNumberType NUMBER_PERCENT, and PRICEDISC, RECEIVED, and ACCRINTM omit NUMBER_CURRENCY. Sibling functions such as TBILLYIELD and TBILLPRICE set these, so getCellValueDetailedType() and type-based formatting treat the new results as raw numbers.
Reviewed by Cursor Bugbot for commit b3989ed. Configure here.
Resolves the CHANGELOG conflict and lists ACCRINTM, DISC, INTRATE, PRICEDISC, RECEIVED and YIELDDISC in the ungrouped function capabilities, as the license capability completeness invariant requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Performance comparison of head (3ec6b6e) vs base (eff7928) |
coerceToSecurityDate truncated before checking the range, so a date such as -0.5 became serial 0, a valid date. Excel returns #NUM! for any negative date, before looking at the later arguments. Reject a negative value before truncating, as coerceToDayCountBasis already does for the basis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1799 +/- ##
===========================================
+ Coverage 97.28% 97.29% +0.01%
===========================================
Files 207 207
Lines 16218 16319 +101
Branches 3588 3612 +24
===========================================
+ Hits 15777 15878 +101
Misses 433 433
Partials 8 8
🚀 New features to boost your workflow:
|


Context
Adds six Excel financial functions for discounted and interest-at-maturity securities:
ACCRINTM,DISC,INTRATE,PRICEDISC,RECEIVEDandYIELDDISC.Shared day-count helper.
DateTimeHelper.dayCountByBasis(startDate, endDate, basis)returns{dayCount, yearDays}for day-count bases 0-4. Basis 0 appliestoBasisUSto copies of the dates (YEARFRAC's US30/360 rule), basis 1 uses
yearLengthForBasis, basis 4 usestoBasisEU.YEARFRACnow uses the helper (its owncommit). YEARFRAC's results are unchanged; DAYS360 is not touched.
Argument handling. Every parameter is
SCALARand is converted in the method, to match Excel:#VALUE!; a blank cell is 0; numeric, percent, currency and date text areaccepted (date text per the
dateFormatsconfig);#NUM!, a negative date such as −0.5 included;basisis truncated (4.9 → 4), but a negative basis such as −0.5 is#NUM!, as in Excel;DISC-like functions (so
DISC(s, m, "abc", r, 9)is#NUM!, not#VALUE!); left to right forACCRINTM.Arithmetic. Each formula uses the operation order that reproduces Excel's results to the 15th significant digit,
for example
DISC = (1 - pr / redemption) * (yearDays / dayCount). Dividing by the year fraction instead differsfrom Excel in the last digit on dozens of cases.
strictNumber. The argument conversion is a privatestrictNumber, copied unchanged (name, signature, JSDoc,body) from
DeltaPluginin #1788; the same helper is inStatisticalPluginin #1789. Follow-up: once these PRs aremerged, extract it into one shared helper.
ACCRINTMpar. An empty or omittedparis 1000. Excel rejects the 3-argument form(
=ACCRINTM(issue, settlement, rate)); Google Sheets accepts it and returns the same 20.5556 as HyperFormula. Addedto
docs/guide/list-of-differences.md. HyperFormula's argument metadata cannot makeparrequired and still map anempty argument to 1000 while a blank cell stays 0.
How did you test your changes?
test is the formula measured in Excel, on the same cell layout as the test fixture (the Microsoft docs example as
the arguments, plus cells for coercion), so any case can be re-checked by entering it in Excel. Cases cover the
docs examples, every basis (29 February, month ends, multi-year spans, zero-day 30/360 spans), coercion of each
argument, truncation, out-of-range dates, the order in which invalid arguments are reported, array arguments and
argument counts.
function-disc117,function-intrate114,function-pricedisc114,function-received114,function-yielddisc114,function-accrintm118. They run withsmartRounding: falseand compare at Excel's 15th significant digit (three rounding ties compare at 14). Config-dependent cases pass their
config:
dateFormats: ['MM/DD/YYYY', 'YYYY-MM-DD']for text dates,useArrayArithmetic: truefor array constants.All failed with
#NAME?before the engine change.DAYS360, EDATE, EOMONTH, DATEDIF, TBILLEQ, TBILLPRICE, TBILLYIELD and date specs pass unchanged.
pairs and February/month-end pairs, both date orders, bases 0-4): 0 differences.
order: 4; PRICEDISC without
* redemption: 66; RECEIVED<= 0→< 0: 1; YIELDDISC dividing by redemption: 65;ACCRINTM
>→>=: 2; basis 0 withouttoBasisUS: 13, YEARFRAC included).npm run lint(0 errors),npm run compile,npm run docs:generate-function-docs,git diff --check.Types of changes
Related issues:
strictNumberinto one shared helper once Add GESTEP function (HF-481) #1788 and Add ERF.PRECISE function (HF-482) #1789 are merged.Checklist:
Translations: names read from Microsoft Excel Online in each language.
csCZkeeps the English names, as Exceldoes.
idIDuses the English names: Google Sheets' Indonesian list keepsINTRATE,RECEIVEDandYIELDDISCinEnglish and does not list the other three (DEV_DOCS fallback).
🤖 Generated with Claude Code
Note
Medium Risk
New financial calculations and a shared day-count helper also used by YEARFRAC; incorrect basis or operation order would affect spreadsheet results, though scope is limited to date/financial plugins.
Overview
Adds six Excel securities functions —
ACCRINTM,DISC,INTRATE,PRICEDISC,RECEIVED, andYIELDDISC— with metadata, i18n names, license gating, and changelog/docs updates.Day-count plumbing:
DateTimeHelper.dayCountByBasis()centralizes bases 0–4 (dayCount/yearDays);YEARFRACis refactored to call it (behavior intended unchanged). The five settlement/maturity functions share a privatediscountedSecurity()path with Excel-style validation order and formulas;ACCRINTMuses the same date/basis coercion plus defaultparof 1000 when omitted/empty.Argument handling: New functions use
SCALARargs and localstrictNumber/coerceToSecurityDate/coerceToDayCountBasishelpers (booleans and""→#VALUE!, etc.).list-of-differences.mdnotes Excel rejects the 3-argumentACCRINTMform while HyperFormula matches Google Sheets.Reviewed by Cursor Bugbot for commit 3ec6b6e. Bugbot is set up for automated code reviews on this repo. Configure here.