pjfanning opened a new pull request, #1295: URL: https://github.com/apache/poi/pull/1295
#1275 made `*` and `/` return 0 for a result below `Double.MIN_NORMAL` (Excel has no subnormal numbers), but nothing else did: the literal `1E-308`, `ABS(1E-308)`, `RADIANS(1E-307)`, `EXP(-709)`, `POWER(1E-200,2)`, `GEOMEAN`, `PMT`, `NPV`, … still stored a subnormal in the cell (displayed as `0`, but not equal to 0). The flush now lives in the two `NumberEval` constructors, the one place every number result passes through: a value with `0 < |value| < Double.MIN_NORMAL` becomes `+0.0`, from a literal, a cell or a function alike. The sign of an actual zero is untouched (`TestMinusZeroResult` still passes), and a negative subnormal becomes `+0` like every other underflow in #1275. Knock-on, and as in Excel: a subnormal divisor is a zero divisor, so `=1/1E-308` and `=MOD(1,1E-308)` are `#DIV/0!`. Two existing assertions that divided by `Double.MIN_VALUE`/`1E-308` to provoke `#NUM!` now use `1E300/1E-300`, and `TestMinusZeroResult` drops its "sub-normal negative numbers display as -0" case since such a number no longer reaches the renderer. Tests: new `TestNumberEval`; `org.apache.poi.ss.formula.*`, `ss.util.*` and the HSSF formula tests 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]
