Skip to content

Add MUNIT, MDETERM and MINVERSE functions (HF-401, HF-399, HF-400) - #1817

Open
marcin-kordas-hoc wants to merge 2 commits into
developfrom
feat/hf-matrix-munit-mdeterm-minverse
Open

marcin-kordas-hoc wants to merge 2 commits into
developfrom
feat/hf-matrix-munit-mdeterm-minverse

Conversation

@marcin-kordas-hoc

Copy link
Copy Markdown
Collaborator

Summary

Adds three matrix functions: MUNIT, MDETERM and MINVERSE (HF-401, HF-399, HF-400).

  • MUNIT(dimension) returns the identity matrix. The dimension is truncated to an integer; 0, negative values, text and an empty text are #VALUE!, and TRUE is 1.
  • MDETERM(array) returns the determinant of a square matrix of numbers. A matrix that is not square, or holds text, an empty cell or a boolean, is #VALUE!. A scalar is its own determinant.
  • MINVERSE(array) returns the inverse of a square matrix. A singular matrix is #NUM!; a matrix that is not square or holds text is #VALUE!.
  • Implemented in MatrixPlugin, with metadata, translations, the license capability table entries and a CHANGELOG entry.

Behaviour check against Excel

60 formulas were evaluated in Excel Online (MS Graph live session) and in HyperFormula: 58 identical, 2 different, 0 not evaluable. They cover MUNIT sizes and truncation, 2x2 and 3x3 matrices, one-cell matrices, scalars, text, booleans, blank cells, errors, non-square ranges and the shape of the results (read through INDEX, ROWS and COLUMNS, because the results spill).

The 2 differences:

  • MDETERM(A1:B2*2): Excel evaluates the arithmetic on the range as an array (-8); HyperFormula needs useArrayArithmetic, otherwise it is #VALUE!.
  • MINVERSE over a range with text: Excel returns #VALUE!; in the measuring layout HyperFormula returns #SPILL!, because the predicted 2x2 result area is blocked by neighbouring formulas.

A further difference is not asserted because it depends on the elimination algorithm: for the singular matrix {1,2,3;4,5,6;7,8,9} Excel returns MDETERM 6.66E-16 and a MINVERSE of values around 4.5E+15, while HyperFormula eliminates exactly and returns 0 and #NUM!. It is listed in docs/guide/list-of-differences.md.

Translations

Names come from the Excel function translation table named in DEV_DOCS.md (Excel 2013), for 15 languages (for example de MEINHEIT, MDET, MINV; pl MACIERZ.JEDNOSTKOWA, WYZNACZNIK.MACIERZY, MACIERZ.ODW). The individual function pages were not checked one by one. enGB, enUS and idID keep the English names.

Tests

Paired tests branch: feat/hf-matrix-munit-mdeterm-minverse in the tests repository (59 tests). Full local run on this head: 521 suites, 6801 passed, 3 skipped.

🤖 Generated with Claude Code

marcin-kordas-hoc and others added 2 commits October 15, 2026 04:53
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperformula-docs 2004308 Commit Preview URL

Branch Preview URL
Oct 15 2026, 06:08 AM

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.09804% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.26%. Comparing base (05c1a29) to head (2004308).

Files with missing lines Patch % Lines
src/interpreter/plugin/MatrixPlugin.ts 95.04% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1817      +/-   ##
===========================================
- Coverage    97.28%   97.26%   -0.02%     
===========================================
  Files          207      207              
  Lines        16218    16320     +102     
  Branches      3588     3614      +26     
===========================================
+ Hits         15777    15874      +97     
- Misses         433      438       +5     
  Partials         8        8              
Files with missing lines Coverage Δ
src/error-message.ts 100.00% <100.00%> (ø)
src/i18n/languages/csCZ.ts 100.00% <ø> (ø)
src/i18n/languages/daDK.ts 100.00% <ø> (ø)
src/i18n/languages/deDE.ts 100.00% <ø> (ø)
src/i18n/languages/enGB.ts 100.00% <ø> (ø)
src/i18n/languages/esES.ts 100.00% <ø> (ø)
src/i18n/languages/fiFI.ts 100.00% <ø> (ø)
src/i18n/languages/frFR.ts 100.00% <ø> (ø)
src/i18n/languages/huHU.ts 100.00% <ø> (ø)
src/i18n/languages/idID.ts 100.00% <ø> (ø)
... and 11 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Performance comparison of head (94b7812) vs base (05c1a29)

                                     testName |    base |   head | change
-------------------------------------------------------------------------
                                      Sheet A |  495.69 | 502.23 | +1.32%
                                      Sheet B |  159.28 | 160.57 | +0.81%
                                      Sheet T |  141.59 | 144.88 | +2.32%
                                Column ranges |  466.47 | 470.63 | +0.89%
                                Sorted lookup | 13550.1 |  13911 | +2.66%
Sheet A:  change value, add/remove row/column |   15.13 |  15.58 | +2.97%
 Sheet B: change value, add/remove row/column |  133.96 | 125.37 | -6.41%
                   Column ranges - add column |  146.85 | 150.03 | +2.17%
                Column ranges - without batch |  449.31 | 480.13 | +6.86%
                        Column ranges - batch |  114.65 |  121.2 | +5.71%

This branch has not been deployed

No deployments
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