Repository navigation
Return #VALUE! for boolean and empty-text arguments of DELTA, ERF and ERFC (HF-554) - #1836
Draft
marcin-kordas-hoc wants to merge 5 commits into
Draft
marcin-kordas-hoc wants to merge 5 commits into
marcin-kordas-hoc wants to merge 5 commits into
Conversation
… ERF and ERFC 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 | 69b6274 | Commit Preview URL Branch Preview URL |
Nov 23 2026, 04:30 AM |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 22, 2026
Performance comparison of head (69b6274) vs base (576d838) |
Collaborator
Author
|
question: this changes |
5 of 12 tasks
Tobiadefami
added a commit
that referenced
this pull request
Nov 16, 2026
### Context The PR adds the `GESTEP` function. - **Why:** it is a standard Excel function that HyperFormula did not have, so formulas using it returned `#NAME?`. - **What changed:** - `DeltaPlugin.ts`: `GESTEP(number, [step])`, next to `DELTA`. - `ArithmeticHelper.ts`: `coerceScalarToNumberRejectingBooleans`, which coerces like `coerceScalarToNumberOrError` but returns `#VALUE!` for a boolean or `""`. `GESTEP` calls it for both arguments, through a wrapper in `FunctionPlugin.ts`. - `engineering.ts`: catalogue entry, in alphabetical order. `functionCapabilities.ts`: `GESTEP` in the license capability table. - 17 language packs: names from the Excel 2013 translation table (dolf.trieschnigg.nl), a source listed in `hyperformula/dev-docs/I18N.md`. - `docs/guide/list-of-differences.md`: three `GESTEP` rows for multi-cell ranges. - `CHANGELOG.md`: one entry, saying what the function returns. - **Result:** `GESTEP` returns `1` when `number >= step` and `0` otherwise; `step` defaults to `0`. - Numbers, dates, percentages, currency, numeric text and empty cells (as `0`) are accepted. - A boolean (literal or cell) and the empty text `""` are `#VALUE!`, as in Excel. - An empty `number` slot, as in `=GESTEP(,0)`, is `#N/A`, as in Excel; an empty `step` slot counts as `0`. - An error in either argument is returned; an error in `step` wins. With array arithmetic off, a multi-cell range in `number` that does not cross the formula's row or column is `#VALUE!` before `step` is checked (list of differences). - Comparison is exact: `GESTEP(0.1+0.2, 0.3)` is 1 and `GESTEP(0.3, 0.1+0.2)` is 0, as in Excel. `DELTA` keeps its current behaviour here; its boolean change is in #1836. The uppercase-exponent fix for number literals is in #1835. ### How did you test your changes? - Paired tests branch: `feat/hf-481-gestep` in `hyperformula-tests`, spec `unit/interpreter/function-gestep.spec.ts` (82 tests, all passing), including the formula under its `plPL` name. - Full Jest run at this head with the paired tests attached: 524 suites, 7164 tests passed, 3 skipped, 0 failed. ESLint on the changed `.ts` files: 0 errors; `tsc --noEmit`: no errors. - With the boolean check removed from `ArithmeticHelper`, 15 of the spec's tests fail; with `number` checked before `step`, 5 fail; with an empty `number` slot read as an empty cell, 3 fail. - Edge cases from our input-class generator (empty cell, `""`, empty slot, booleans, numeric text, errors, magnitudes, 1x1 and larger ranges, inline arrays, computed arrays, whole columns, other sheets, names, error order), 86 formulas measured in Excel Online on 2026-11-06: 76 identical, 2 refused by Excel (`1e308`), 8 different: - `1E5` in either argument: the uppercase exponent does not parse before #1835. - A computed array such as `A1:A2*1` in either argument, with array arithmetic off, from a row the array does not cross: `#VALUE!`; with array arithmetic on, the same as Excel. - A whole column (`A:A`) in either argument: Excel returns `#VALUE!` for any multi-cell reference, while HyperFormula, with array arithmetic off, intersects one that crosses the formula's row. Measured again with `=GESTEP(A1:A3,4)` in B2, which is the row in the list of differences. - A multi-cell range in `number` with `#N/A` in `step`, from a row the range does not cross: also in the list of differences. - 13 formulas with an empty argument measured in Excel Online: all `GESTEP` results identical. `=DELTA(,0)` is `#N/A` in Excel and `1` here (out of scope). - The 57 `GESTEP` and `DELTA` formulas measured earlier in Excel Online, replayed at this head: 47 identical, 9 different, 1 not evaluable in Excel (three arguments, which Excel refuses). - 7 differences are `DELTA` with a boolean argument: Excel returns `#VALUE!`, this branch keeps the current result (#1836). - 2 are `GESTEP(1E-300,0)` and `GESTEP(-1E-300,0)`: the uppercase exponent does not parse before #1835. With `1e-300` they return 1 and 0. ### AI assistance Claude Code wrote the `GESTEP` implementation, the `ArithmeticHelper` coercion, the catalogue and license entries, the language-pack names, the list-of-differences rows, the CHANGELOG entry, the paired tests and this description. Every commit on both branches, other than merges, carries its co-author line. ### Compatibility with Excel and Google Sheets Excel values are the saved Excel Online results. Google Sheets was not measured. | Formula | Data | Excel | Google Sheets | HyperFormula | |---|---|---|---|---| | `=GESTEP(4,4)` | | 1 | not measured | 1 | | `=GESTEP(-5)` | | 0 | not measured | 0 | | `=GESTEP(A1,B1)` | 50%, 20% | 1 | not measured | 1 | | `=GESTEP("5","4")` | | 1 | not measured | 1 | | `=GESTEP(D1,-1)` | D1 empty | 1 | not measured | 1 | | `=GESTEP(,0)` | | `#N/A` | not measured | `#N/A` | | `=GESTEP(,1/0)` | | `#DIV/0!` | not measured | `#DIV/0!` | | `=GESTEP(TRUE(),0)` | | `#VALUE!` | not measured | `#VALUE!` | | `=GESTEP(1,F1)` | F1 `=1/0` | `#DIV/0!` | not measured | `#DIV/0!` | | `=GESTEP(A1:B1,4)` in C5 | 5, 4 | `#VALUE!` | not measured | `#VALUE!` | | `=GESTEP(A1:A3,4)` in B2 | 1, 5, 2 | `#VALUE!` | not measured | `1` (list of differences) | | `=GESTEP(0.1+0.2,0.3)` | | 1 | not measured | 1 | ### Public API changes None in the generated API reference. `FunctionPlugin` gains a protected wrapper, `coerceScalarToNumberRejectingBooleans`, next to `coerceScalarToNumberOrError`; protected members are left out of the generated reference. The function is listed by `getAvailableFunctions()` like any other built-in function. ### Out of scope and follow-ups - `DELTA` with booleans: #1836. Number literals with an uppercase exponent: #1835. - `=DELTA(,0)`: `#N/A` in Excel, `1` here; not changed in this PR. - English names are kept where the translation table has none: `csCZ`, `enGB` and `idID`. The individual Microsoft pages were not checked one by one. ### Types of changes - [ ] Breaking change (existing functionality no longer works as before) – agreed with the maintainers - [x] New feature or improvement (a non-breaking change that adds functionality) - [ ] Bug fix (a non-breaking change that fixes an issue) - [x] Additional language file, or a change to an existing language file (translations) - [x] Change to the documentation ### Related issues 1. HF-481 ### Checklist - [x] My pull request meets the [Definition of Done](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DEFINITION-OF-DONE.md). External contributors: see also [Contributing to HyperFormula](https://handsontable.com/docs/hyperformula/guide/contributing.html). - [ ] I have signed the [Contributor License Agreement](https://goo.gl/forms/yuutGuN0RjsikVpM2). - [x] I read my own diff end to end before requesting a review. - [x] I added a [CHANGELOG.md](https://github.com/handsontable/hyperformula/blob/develop/CHANGELOG.md) entry, written by [the changelog rules](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DOC-STANDARDS.md#the-changelog) – or none is needed (docs, tests or tooling only). - [x] I updated the documentation and JSDoc to match the change. - [ ] Breaking change only: I added a section to the migration guide. - [x] I updated the `dev-docs/` pages this change affects – or none needed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Additive built-in function and i18n/docs; no changes to auth, persistence, or existing function behavior except a new protected coercion helper. > > **Overview** > Adds Excel's **`GESTEP`** function to HyperFormula: it returns **1** when `number >= step` (default **0**) and **0** otherwise. Implementation lives in **`DeltaPlugin`** alongside **`DELTA`**, with scalar coercion via a new **`coerceScalarToNumberRejectingBooleans`** helper (booleans and `""` become `#VALUE!`; empty `number` argument slots become `#N/A`). > > The function is wired into the **engineering** metadata, **license** capabilities, **17 language packs**, **CHANGELOG**, and **`list-of-differences`** (noting Excel divergences for multi-cell ranges and array arithmetic). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 92f6852. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: tobiadefami <tobiadefami@gmail.com>
…d helper develop has coerceScalarToNumberRejectingBooleans, which GESTEP uses; the two strictNumber helpers now call it instead of repeating its rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The develop merge left the DELTA, ERF and ERFC entry under a second Changed heading; it now sits in the existing section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1836 +/- ##
========================================
Coverage 97.64% 97.64%
========================================
Files 212 212
Lines 18328 18345 +17
Branches 4258 4296 +38
========================================
+ Hits 17896 17913 +17
- Misses 424 432 +8
+ Partials 8 0 -8
🚀 New features to boost your workflow:
|
marcin-kordas-hoc
added a commit
that referenced
this pull request
Nov 26, 2026
### Context The PR adds the `ERF.PRECISE` function. - **Why:** it is a standard Excel function that HyperFormula did not have, so formulas using it returned `#NAME?`. - **What changed:** - `StatisticalPlugin.ts`: `ERF.PRECISE(x)`, computed by the same `erf` as the one-argument `ERF`. - `ERF.PRECISE` reads its argument through `ArithmeticHelper.coerceScalarToNumberRejectingBooleans`, which `GESTEP` (#1788) added on `develop`: it returns `#VALUE!` for a boolean or the empty text. `ArithmeticHelper.ts` is not changed. - `engineering.ts`: catalogue entry. `functionCapabilities.ts`: `ERF.PRECISE` in the license capability table. - 17 language packs: names from the Excel 2013 translation table (dolf.trieschnigg.nl), a source listed in `hyperformula/dev-docs/I18N.md`, except `ptPT`. That pack uses the Brazilian Portuguese names (`ERF` is `FUNERRO`), so `ERF.PRECISE` is `FUNERRO.PRECISO`, as on Microsoft's pt-BR function page; the table gives the European `FUNCERRO.PRECISO`. - `docs/guide/list-of-differences.md`: a paragraph on accuracy near zero (see Out of scope), a row for `=ERF.PRECISE(A1:B1)` in A5, which returns a number here and `#VALUE!` in Excel, and a row for `=ERF.PRECISE(A1:A3)` with `useArrayArithmetic: true`, which spills one value per cell here. - `CHANGELOG.md`: one entry. - **Result:** `ERF.PRECISE(x)` returns the error function integrated from 0 to `x`. - Numbers, dates, numeric text and empty cells are accepted. - A boolean and the empty text `""` are `#VALUE!`, as in Excel. An error argument is returned. `ERF` and `ERFC` keep their current handling of booleans here; that change is in #1836, which can use the same `coerceScalarToNumberRejectingBooleans`. ### How did you test your changes? - Paired tests branch: `feat/hf-482-erf-precise` in `hyperformula-tests`, spec `unit/interpreter/function-erf.precise.spec.ts`: 72 tests with one assertion each, all passing. Two of them use the Polish name `FUNKCJA.BŁ.DOKŁ`: parsed in a `plPL` engine, and shown in `plPL` for a formula entered in English; both fail when the `plPL` entry is misspelled. Excel Online shows the same Polish name. A third calls `FUNERRO.PRECISO` in a `ptPT` engine and fails with `FUNCERRO.PRECISO`. - With the boolean and empty-text check removed from `coerceScalarToNumberRejectingBooleans`, the 5 boolean cases fail. `""` still gives `#VALUE!`, because `coerceScalarToNumberOrError` has rejected it since #1768. - Full Jest run at this head with the paired tests attached (CI): 16479 passed, 3 skipped, 0 failed, in 582 suites. `tsc --noEmit`: 0 errors. ESLint on the changed `.ts` files (engine and tests): 0 errors; the full lint runs in CI. - 54 `ERF.PRECISE`, `ERF` and `ERFC` formulas were measured earlier in Excel Online (Microsoft Graph). Replayed in HyperFormula at this head, relative tolerance 1e-12: 41 identical, 11 different, 2 not evaluable in Excel (zero and two arguments). - 2: `ERF(TRUE())` and `ERFC(TRUE())` are `#VALUE!` in Excel and numbers in HyperFormula (#1836). - 2: `ERF.PRECISE(1e-10)` and `ERF.PRECISE(1e-300)` lose relative accuracy in the shared `erf` (fixed in #1795). - 6: decimal-separator cases. The Excel account used Polish settings, where `"0,5"` is a number and `"0.5"` is not. - 1: a two-cell range in a one-value argument, recorded in the list of differences. - Edge inputs from the edge matrix (48 cases: empty cell, text, booleans, errors, magnitudes, ranges, array literals, names) measured in Excel Online on 2026-11-05: 14 differ. 10 are ranges of more than one cell, `#VALUE!` in Excel, where HyperFormula takes one cell or spills (the list-of-differences row); 2 are `1e-7` and `1e-300` (accuracy, fixed in #1795); 2 are inputs Excel does not accept (no argument, `1e308`). - The accuracy paragraph was checked against the Maclaurin series of `erf` (60-digit decimal arithmetic) for 120 arguments from `1e-10` to `0.9`: at the 11 significant digits returned by default, every argument from `1e-6` down differs from the exact value, and the largest argument with a different last digit is `1.5e-4`. - Away from zero the results agree with Excel to the 11 significant digits HyperFormula returns by default. ### AI assistance Claude Code (Claude Opus and Claude Sonnet) wrote the code, the tests and the documentation changes in this pull request and in hyperformula-tests#82. Every commit on both branches, other than merges, carries its co-author line. ### Compatibility with Excel and Google Sheets Excel values are the saved Excel Online results. Google Sheets was not measured. | Formula | Data | Excel | Google Sheets | HyperFormula | |---|---|---|---|---| | `=ERF.PRECISE(0.5)` | | 0.520499877813047 | not measured | 0.52049987781 | | `=ERF.PRECISE(-1)` | | -0.842700792949715 | not measured | -0.84270079295 | | `=ERF.PRECISE(E1)` | E1 empty | 0 | not measured | 0 | | `=ERF.PRECISE("1")` | | 0.842700792949715 | not measured | 0.84270079295 | | `=ERF.PRECISE(TRUE())` | | `#VALUE!` | not measured | `#VALUE!` | | `=ERF.PRECISE("")` | | `#VALUE!` | not measured | `#VALUE!` | | `=ERF.PRECISE(F1)` | F1 `=1/0` | `#DIV/0!` | not measured | `#DIV/0!` | | `=ERF.PRECISE(1e-10)` | | 1.12837916709551E-10 | not measured | 1.128379612E-10 | | `=ERF.PRECISE(A1:B1)` in A5 | 0.5, 1 | `#VALUE!` | not measured | 0.52049987781 | ### Public API changes None. The function is listed by `getAvailableFunctions()` like any other built-in function. ### Out of scope and follow-ups - Accuracy near zero: the list-of-differences paragraph added here describes the current `erf`. #1795 fixes it, so whichever of the two merges second drops that paragraph. - English names are kept where the translation table has none: `csCZ`, `daDK`, `enGB` and `idID`. The individual Microsoft pages were checked only for `ptPT`. ### Types of changes - [ ] Breaking change (existing functionality no longer works as before) – agreed with the maintainers - [x] New feature or improvement (a non-breaking change that adds functionality) - [ ] Bug fix (a non-breaking change that fixes an issue) - [x] Additional language file, or a change to an existing language file (translations) - [x] Change to the documentation ### Related issues 1. HF-482 ### Checklist - [x] My pull request meets the [Definition of Done](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DEFINITION-OF-DONE.md). External contributors: see also [Contributing to HyperFormula](https://handsontable.com/docs/hyperformula/guide/contributing.html). - [ ] I have signed the [Contributor License Agreement](https://goo.gl/forms/yuutGuN0RjsikVpM2). - [x] I read my own diff end to end before requesting a review. - [x] I added a [CHANGELOG.md](https://github.com/handsontable/hyperformula/blob/develop/CHANGELOG.md) entry, written by [the changelog rules](https://github.com/handsontable/hyperformula/blob/develop/dev-docs/DOC-STANDARDS.md#the-changelog) – or none is needed (docs, tests or tooling only). - [x] I updated the documentation and JSDoc to match the change. - [ ] Breaking change only: I added a section to the migration guide. - [x] I updated the `dev-docs/` pages this change affects – or none needed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Non-breaking additive function with localized names and documentation; numerical behavior reuses existing erf and only adds targeted coercion. > > **Overview** > Adds **`ERF.PRECISE`**, the Excel one-argument Gaussian error integral from 0 to *x*, wired through **`StatisticalPlugin`** using the same **`erf`** implementation as single-argument **`ERF`**. > > Argument handling is stricter for Excel parity: a new **`ArithmeticHelper.coerceScalarToNumberRejectingBooleanOrError`** returns **`#VALUE!`** for booleans and **`""`** (while other coercions still apply). The function is registered in engineering metadata, the license capability list, **17** locale dictionaries, **CHANGELOG**, and **list-of-differences** (multi-cell range vs Excel **`#VALUE!`**, shared near-zero accuracy limits with **`ERF`**/**`ERFC`**). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e424abc. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Context
The PR makes
DELTA,ERFandERFCreturn#VALUE!for a boolean or the empty text"", as Excel does.TRUE,FALSEand""to numbers, so=DELTA(TRUE())returns0where Excel returns#VALUE!.hyperformula/src/interpreter/plugin/DeltaPlugin.ts:DELTAtakes scalars and rejects booleans and"".hyperformula/src/interpreter/plugin/StatisticalPlugin.ts: the same forERFandERFC.""give#VALUE!.This changes results that existing sheets may rely on, which the Definition of Done counts as a breaking change. It is a draft until that is decided; a migration-guide section follows the decision.
How did you test your changes?
fix/hf-554-boolean-args-delta-erfinhyperformula-tests: theDELTA,ERFandERFCspecs. 4 of their 21 tests fail without the change and all pass with it.jestrun on this branch: 6750 passed, 3 skipped.DELTA,ERFandERFCformulas againstdevelop: the only results that change from a number to an error are those with a boolean or""argument.Compatibility with Excel and Google Sheets
Checked in Excel Online.
A20is an empty cell.=DELTA(TRUE())#VALUE!0#VALUE!=DELTA(FALSE())#VALUE!1#VALUE!=DELTA("")#VALUE!1#VALUE!=DELTA(A20)111=DELTA("1",1)111=ERF(TRUE())#VALUE!0.84270079295#VALUE!=ERF("")#VALUE!0#VALUE!=ERF(0.5,TRUE())#VALUE!0.32220091514#VALUE!=ERFC(TRUE())#VALUE!0.15729920705#VALUE!Public API changes
None. Function results change for boolean and
""arguments.Out of scope and follow-ups
The new
GESTEPandERF.PRECISEfunctions already handle these arguments this way in their own pull requests.Types of changes
Related issues
Checklist
dev-docs/pages this change affects – or none needed it.🤖 Generated with Claude Code