pjfanning opened a new pull request, #1285:
URL: https://github.com/apache/poi/pull/1285
Small Excel-fidelity fix from the arithmetic re-review.
- `=0^0` and `=POWER(0,0)` returned 1 (`Math.pow`); Excel gives `#NUM!`.
- `=0^-1` returned `#NUM!` (via the infinity check) and `=POWER(0,-1)`
likewise; Excel gives `#DIV/0!`.
Both the `^` operator (`TwoOperandNumericOperation.PowerEval`) and the
`POWER` function (`NumericFunction.POWER`) now check for a zero base first.
`0^positive` = 0 and `x^0` = 1 for any non-zero `x` are unchanged.
Also in the same class: the array-evaluation path of the two-operand
operators built a `NumberEval` straight from the double, bypassing the `-0.0`,
subnormal and NaN/Infinity handling the scalar path has, so `{1E200}*{1E200}`
produced an `Infinity` element (and `{0}^{0}` would have produced 1 after the
change above). The scalar and array paths now share one `toValueEval`
conversion.
Tests: `TestPowerEval.testZeroBase` / `testInSpreadSheetZeroBase` (operator,
function and array forms). Ran `ss.formula.eval.*`, `TestNumericFunction`,
`TestMultiOperandNumericFunction`, `TestFormulaEvaluatorBugs` locally: 472
tests, 0 failures.
Independent of #1282 (which touches the same `PowerEval` method — trivial to
resolve whichever lands second).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]