Description:
- The
^ exponentiation operator is missing from the formula grammar.
=5^2 returns #ERROR! because the parser does not recognise the token.
- The
POWER(x, n) function works correctly, so the underlying math is fine — only the operator path is missing.
- Bind
^ tighter than *// and right-associatively (2^3^2 = 2^(3^2) = 512).
Minimal reproduction
| Cell |
Formula |
Expected |
Actual |
Status |
| A1 |
=5^2 |
"25" |
"#ERROR!" |
✗ |
| A2 |
=POWER(5, 2) |
"25" |
"25" |
✓ |
| A3 |
=2^10 |
"1024" |
"#ERROR!" |
✗ |
| A4 |
=2^0.5 |
"1.4142…" |
"#ERROR!" |
✗ |
POWER() works → underlying Math.pow is fine. Only the ^ operator is missing from the grammar.
Why:
packages/sheets/src/formula/antlr/Formula.g4 does not include a power-operator rule.
Description:
^exponentiation operator is missing from the formula grammar.=5^2returns#ERROR!because the parser does not recognise the token.POWER(x, n)function works correctly, so the underlying math is fine — only the operator path is missing.^tighter than*//and right-associatively (2^3^2 = 2^(3^2) = 512).Minimal reproduction
=5^2"25""#ERROR!"=POWER(5, 2)"25""25"=2^10"1024""#ERROR!"=2^0.5"1.4142…""#ERROR!"POWER()works → underlyingMath.powis fine. Only the^operator is missing from the grammar.Why:
packages/sheets/src/formula/antlr/Formula.g4does not include a power-operator rule.