pjfanning opened a new pull request, #1294:
URL: https://github.com/apache/poi/pull/1294
The remaining one-off findings from the function fuzz.
| Formula | Before | After (Excel) |
|---|---|---|
| `=REPT("x",-1)` | `NegativeArraySizeException` | `#VALUE!` |
| `=REPT("x",1E9)` | allocates a 1 GB `StringBuilder` (then `#VALUE!`, if it
survives) | `#VALUE!` before anything is built — Excel caps the result at
32,767 characters |
| `=ADDRESS(0,1)` | `$A` | `#VALUE!` |
| `=ADDRESS(-1,-1)` | `IllegalArgumentException` from `CellReference` |
`#VALUE!` |
| `=MINVERSE({0,0;0,0})` | `SingularMatrixException` | `#NUM!` |
| `=MINVERSE({1,2;2,4})` | an "inverse" of ~4E15 entries | `#NUM!` |
| `=SQRTPI(1E308)` | `Infinity` cell | `#NUM!` |
| `=DOLLARDE(1E308,1E308)` | `Infinity` | `1E+308` |
| `=DOLLARDE(1E19,16)` | `9.22E18` | `1E+19` |
- `REPT`: the count is truncated, a negative count or an oversize result is
`#VALUE!` (checked from the count, so the string is never allocated), and a
one-cell area count is accepted.
- `MINVERSE`: uses `LUDecomposition` (default singularity threshold) rather
than `MatrixUtils.inverse`, which is a QR decomposition with a zero threshold
and so lets rounding turn an exactly singular matrix into a "regular" one;
`SingularMatrixException` becomes `#NUM!`.
- `DOLLARDE`/`DOLLARFR`: the integer part was taken through
`Double.longValue()`, which saturates at `Long.MAX_VALUE`; it is now
`Math.floor` on the absolute value, and the result is checked for infinity.
- `SQRTPI`: result checked.
Tests: new `TestErrorValuesInsteadOfExceptions`;
`org.apache.poi.ss.formula.*` and `TestMatrixFormulasFromBinarySpreadsheet`
pass.
🤖 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]