Repository navigation
functions: MIN() accepts zero arguments - #159
Merged
h-a-n-a-s-h-i merged 1 commit intoOct 10, 2026
Merged
Conversation
Excel documents the first argument of MIN as optional and returns 0 when there are no numbers. MIN was registered with a minimum of one argument, so =MIN() returned #VALUE!. The aggregate already returns 0 for an empty list, so only the registered arity needed to change. Fixes storytold#138 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Landed — thank you for the contribution! Small and correct — thanks for the test too. If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
quantmind-br
added a commit
to quantmind-br/gridcraft
that referenced
this pull request
Oct 10, 2026
Conflicts resolved by keeping both intents: - criteria/core: storytold#57's 15-significant-digit compare_numbers next to M12's locale-aware criteria parsing; MIN takes storytold#159's zero-argument arity with the regional number coercion. - calc: storytold#148's range-ending-in-a-function precedents next to the unified is_special. - csv: storytold#127's "a candidate must appear on every line" rule applies to the regional sniffer; when none does, the region's list separator wins. - formula bar: storytold#156's legacy array braces around the localized formula. - data/mcp tests: both sides' additions kept. Follow-ups for the merged code: - table.resize: a repeated header is numbered as insert.table does (`Column2` -> `Column22`) and new or blank headers are written into the header cells, so storytold#149's header sync (header cell == column name) no longer renames resized columns positionally. - formula bar: the cell-picture text from storytold#105 goes through Fluent in all 12 languages.
quantmind-br
added a commit
to quantmind-br/gridcraft
that referenced
this pull request
Oct 10, 2026
…rmats) Interface, formula language and regional format work as in Excel: function names, booleans, errors and format-code letters follow the formula language (the interface language by default, or en-US); separators, dates, months and currency follow the regional format. Workbooks, XLSX, the journal and programmatic params stay canonical (English names, `,` arguments, `.` decimal), so a file opens the same in every language. Local text only crosses the engine boundary as `*Local` fields. Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP, ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function names, as Excel does). - locale (new, L0): language and region data in TOML, validated by build.rs (missing keys, duplicate local names, colliding separators, canonical en-US), CLDR-style negotiation of OS and browser tags. - formula: tokenize/parse/print per dialect; one function catalog with file prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters). In ru-RU `:` separates array-constant rows: inside braces a number followed by `:` is a number, since array constants hold no references. - core, numfmt, functions, calc: regional input parsing and text-to-number coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR, VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B functions. - l10n (new, L4): Fluent messages for all 12 languages, same keys and arguments as en-US; `cargo xtask locales` reports coverage and runs in ci. - engine: locale prefs, app.setLocale / app.getInternational / app.languages, file.options (catalog: 259 / 290), inputLocal / formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable EngineError codes, regional CSV, app-created content in the interface language. - ui-egui and apps: translated UI and native menus, local formula editing with autocomplete and argument hints, Options > Language (live switch), localized shortcuts where Excel localizes them, IME, CJK font fallback (font bytes validated before egui sees them), system locale detection, localStorage prefs on the web, CLI --locale, MCP local params. Built on upstream work: - Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every upstream language stays, Russian is the 12th (function names voted from Microsoft's ru-RU pages, checked against independent tables, with aliases such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set and shares the preference with Options > Language; ui.json language codes migrate once to prefs.json unless they are what old builds detected from the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with translated captions; key tip letters stay English in every language. - Spanish formulas (storytold#98) are folded into this design: names follow the interface language and separators the region, so FormulaLocale, UiState.language and docs/formula-input.md are superseded. Its name-precedence rule is kept and generalized: defined names, table names and LET/LAMBDA bindings win over localized function names and booleans (parse_local_with/print_local_with, Workbook::knows_name) in cell input, *Local params, display, find/replace, CF, validation, names, FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal re-reads *Local params against the workbook as the command found it. storytold#98's UI tests are ported. - Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready). - storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the every-line delimiter rule applies to the regional CSV sniffer, whose fallback is the region's list separator. storytold#156: legacy array braces around the localized formula. storytold#149: table.resize writes the names it chooses into the header cells and numbers repeated headers like insert.table. storytold#105: cell-picture strings in all 12 languages. - Restored upstream behaviour: imported ODS/XLSB files are titled "<name> (imported).xlsx"; the import message shows 5 warnings plus a count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quantmind-br
added a commit
to quantmind-br/gridcraft
that referenced
this pull request
Oct 11, 2026
…rmats) Interface, formula language and regional format work as in Excel: function names, booleans, errors and format-code letters follow the formula language (the interface language by default, or en-US); separators, dates, months and currency follow the regional format. Workbooks, XLSX, the journal and programmatic params stay canonical (English names, `,` arguments, `.` decimal), so a file opens the same in every language. Local text only crosses the engine boundary as `*Local` fields. Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP, ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function names, as Excel does). - locale (new, L0): language and region data in TOML, validated by build.rs (missing keys, duplicate local names, colliding separators, canonical en-US), CLDR-style negotiation of OS and browser tags. - formula: tokenize/parse/print per dialect; one function catalog with file prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters). In ru-RU `:` separates array-constant rows: inside braces a number followed by `:` is a number, since array constants hold no references. - core, numfmt, functions, calc: regional input parsing and text-to-number coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR, VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B functions. - l10n (new, L4): Fluent messages for all 12 languages, same keys and arguments as en-US; `cargo xtask locales` reports coverage and runs in ci. - engine: locale prefs, app.setLocale / app.getInternational / app.languages, file.options (catalog: 259 / 290), inputLocal / formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable EngineError codes, regional CSV, app-created content in the interface language. - ui-egui and apps: translated UI and native menus, local formula editing with autocomplete and argument hints, Options > Language (live switch), localized shortcuts where Excel localizes them, IME, CJK font fallback (font bytes validated before egui sees them), system locale detection, localStorage prefs on the web, CLI --locale, MCP local params. Built on upstream work: - Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every upstream language stays, Russian is the 12th (function names voted from Microsoft's ru-RU pages, checked against independent tables, with aliases such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set and shares the preference with Options > Language; ui.json language codes migrate once to prefs.json unless they are what old builds detected from the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with translated captions; key tip letters stay English in every language. - Spanish formulas (storytold#98) are folded into this design: names follow the interface language and separators the region, so FormulaLocale, UiState.language and docs/formula-input.md are superseded. Its name-precedence rule is kept and generalized: defined names, table names and LET/LAMBDA bindings win over localized function names and booleans (parse_local_with/print_local_with, Workbook::knows_name) in cell input, *Local params, display, find/replace, CF, validation, names, FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal re-reads *Local params against the workbook as the command found it. storytold#98's UI tests are ported. - Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready). - storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the every-line delimiter rule applies to the regional CSV sniffer, whose fallback is the region's list separator. storytold#156: legacy array braces around the localized formula. storytold#149: table.resize writes the names it chooses into the header cells and numbers repeated headers like insert.table. storytold#105: cell-picture strings in all 12 languages. - Restored upstream behaviour: imported ODS/XLSB files are titled "<name> (imported).xlsx"; the import message shows 5 warnings plus a count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quantmind-br
added a commit
to quantmind-br/gridcraft
that referenced
this pull request
Oct 11, 2026
…rmats) Interface, formula language and regional format work as in Excel: function names, booleans, errors and format-code letters follow the formula language (the interface language by default, or en-US); separators, dates, months and currency follow the regional format. Workbooks, XLSX, the journal and programmatic params stay canonical (English names, `,` arguments, `.` decimal), so a file opens the same in every language. Local text only crosses the engine boundary as `*Local` fields. Languages: en-US, pt-BR, pt-PT, es-ES, fr-FR, de-DE, it-IT, ru-RU, ja-JP, ko-KR, zh-CN, zh-TW (Japanese, Korean and Chinese keep English function names, as Excel does). - locale (new, L0): language and region data in TOML, validated by build.rs (missing keys, duplicate local names, colliding separators, canonical en-US), CLDR-style negotiation of OS and browser tags. Only en-US must list every function: one another language doesn't list yet keeps its English spelling there, so adding a worksheet function needs English data only. - formula: tokenize/parse/print per dialect; one function catalog with file prefixes replaces the four hand-kept lists (_xlfn., _xludf. for canonical names typed in a localized dialect, _xlpm. for LET/LAMBDA parameters). In ru-RU `:` separates array-constant rows: inside braces a number followed by `:` is a number, since array constants hold no references. - core, numfmt, functions, calc: regional input parsing and text-to-number coercion, localized number-format codes and display, TEXT/FIXED/DOLLAR, VALUE/DATEVALUE/NUMBERVALUE, criteria, CELL/INFO keywords, DBCS *B functions. - l10n (new, L4): Fluent messages for all 12 languages, same keys and arguments as en-US (function descriptions may fall back to en-US); `cargo xtask locales` reports coverage, lists untranslated function names and descriptions as warnings, and runs in ci. - engine: locale prefs, app.setLocale / app.getInternational / app.languages, file.options (catalog: 259 / 290), inputLocal / formulaLocal / valueLocal / numberFormatLocal / refersToLocal, stable EngineError codes, regional CSV, app-created content in the interface language. - ui-egui and apps: translated UI and native menus, local formula editing with autocomplete and argument hints, Options > Language (live switch), localized shortcuts where Excel localizes them, IME, CJK font fallback (font bytes validated before egui sees them), system locale detection, localStorage prefs on the web, CLI --locale, MCP local params. Built on upstream work: - Interface languages (storytold#31, storytold#82, storytold#104): the hand-written table in crates/ui-egui/src/i18n.rs is folded into the Fluent catalog; every upstream language stays, Russian is the 12th (function names voted from Microsoft's ru-RU pages, checked against independent tables, with aliases such as УСЛОВИЯ and ЕСЛИНД). The View-tab picker runs app.language.set and shares the preference with Options > Language; ui.json language codes migrate once to prefs.json unless they are what old builds detected from the system. Text box editing (storytold#84) and key tips (storytold#43) keep working, with translated captions; key tip letters stay English in every language. - Spanish formulas (storytold#98) are folded into this design: names follow the interface language and separators the region, so FormulaLocale, UiState.language and docs/formula-input.md are superseded. Its name-precedence rule is kept and generalized: defined names, table names and LET/LAMBDA bindings win over localized function names and booleans (parse_local_with/print_local_with, Workbook::knows_name) in cell input, *Local params, display, find/replace, CF, validation, names, FORMULATEXT and INDIRECT. A built-in whose local spelling a name took is written with its file prefix (_xlfn.SUM, _xlfn.FALSE()). The journal re-reads *Local params against the workbook as the command found it. storytold#98's UI tests are ported. - Progress docs (storytold#189): localization re-measured (~10% -> ~50% ready). - storytold#57/storytold#159: compare_numbers and MIN() with no arguments use the regional coercion. storytold#148: precedents of ranges ending in a function. storytold#127: the every-line delimiter rule applies to the regional CSV sniffer, whose fallback is the region's list separator. storytold#156: legacy array braces around the localized formula. storytold#149: table.resize writes the names it chooses into the header cells and numbers repeated headers like insert.table. storytold#105: cell-picture strings in all 12 languages. - Restored upstream behaviour: imported ODS/XLSB files are titled "<name> (imported).xlsx"; the import message shows 5 warnings plus a count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
MIN() returned #VALUE! instead of 0.
MIN was registered with a minimum of one argument, so the dispatcher rejected the empty call before the aggregate ran. Microsoft's MIN documentation makes the first argument optional and says MIN returns 0 when there are no numbers. The aggregate already returned 0 for an empty list, so only the registered arity was wrong.
The fix lowers MIN's minimum argument count from 1 to 0. I followed Microsoft's MIN documentation here; I did not run Excel.
MAX is unchanged. Its documented first argument is required, so =MAX() is not covered by this fix. MINA and MAXA are also unchanged.
Tested with a new assertion in
min_max_orderincrates/functions/src/stat.rsthat checksMIN()returns 0. It failed before the change (expected number 0, got Error(Value)) and passes after.gridcraft-cli eval '=MIN()'now prints 0, and the non-empty controls (=MIN(A1:A10),=MIN(2,3)) are unchanged.cargo xtask cipasses.Fixes #138
🤖 Generated with Claude Code