FN-ROUND-003: Near DBL_MAX, ROUND returns NaN bit patterns that Excel treats as numbers
Excel differs from the mathematical answer · measured · recorded 2026-11-04
ROUND of a number near 1.8E308 can return a binary64 with an all-ones exponent field. A decimal result of 2^1024 or more keeps its 53-bit significand, and its exponent is carried into the exponent field without a check, so the bits are a NaN. ROUND, ROUNDDOWN and TRUNC return those bits; ROUNDUP gives #NUM!. The recorded rows hold 430 such ROUND rows, 102 ROUNDDOWN and 95 TRUNC, and all 627 follow this. Even ROUND(DBL_MAX,0), whose answer is DBL_MAX, returns 0x7ff000000000000a. The cell shows 2E+308 or 1.8E+308, and a pattern with its sign bit set shows 2E+308 too, with no minus. ISNUMBER gives TRUE, ISERROR FALSE, TYPE 1, ERROR.TYPE #N/A; A1=A1 and A1>0 are TRUE. =A1, N(A1), MAX(A1), ABS(A1) and IFERROR(A1,...) pass the pattern on, as does =-A1 with its sign unchanged. Arithmetic on it (A1+0, A1*1, A1-A1, SUM, ROUND) gives #NUM!, and TEXT(A1,"0") gives #VALUE!. Saved to .xlsx, each such cell is written as the error #NUM!; reopened, the cells read #NUM! until a full recalculation brings the patterns back.
| Call and input route | Inputs | Excel | Correct value | Recorded in |
|---|---|---|---|---|
ROUND(1.7976931348623157E+308, 0)cell-value2 | number: 1.7976931348623157e+3080x7fefffffffffffffnum_digits: 00x0000000000000000 | NaN bit pattern, shown as 1.8E+3080x7ff000000000000a | 1.7976931348623157e+3080x7fefffffffffffff | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
ROUND(1.7976931348623157E+308, -307)cell-value2 | number: 1.7976931348623157e+3080x7fefffffffffffffnum_digits: -3070xc073300000000000 | NaN bit pattern, shown as 1.8E+3080x7ff005419221015d | #NUM! | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
ROUND(1.7976931348623157E+308, -308)cell-value2 | number: 1.7976931348623157e+3080x7fefffffffffffffnum_digits: -3080xc073400000000000 | NaN bit pattern, shown as 2E+3080x7ff1ccf385ebc8a0 | #NUM! | Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading |
Correct value: DBL_MAX is an integer, so rounding it to 0 places returns it.
Correct value: The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.
Correct value: The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.
Basis: One Excel workbook read cell by cell through Value2 on 2026-11-04, saved, reopened and recalculated; rows from the rounding write-up, 627 of 627.
Inferred: That one decimal-to-binary conversion routine is the source of all these patterns is inferred from the exponent-overflow encoding.
Open: How these patterns sort among themselves and with other numbers, and display width, are not recorded.
Evidence and capture sources
- DnaCalc · crates/calc-func/src/catalogue/rounding.rs ab94fb91a50fbdf89bdb2dac0e12fcd77a5e5f82 · the rules in the product; the commit message carries the row counts
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream.json b5d84a80a5a4640eca9ce04f232c0bc115503f34 · cells A1..A4, B1..B24, reopened, recalculated cell-by-cell Excel reading of the NaN patterns
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream.ps1 b5d84a80a5a4640eca9ce04f232c0bc115503f34 · the script that took the reading
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream-sheet1.xml b5d84a80a5a4640eca9ce04f232c0bc115503f34 · the sheet as Excel saved it
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/rounding-EVIDENCE.md b5d84a80a5a4640eca9ce04f232c0bc115503f34 · research write-up: full-bank result, the rules, what stays open
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream.json b5d84a80a5a4640eca9ce04f232c0bc115503f34 · cells.A3
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream.json b5d84a80a5a4640eca9ce04f232c0bc115503f34 · cells.A2
- ExcelFunctionsHandbook · content/notes/evidence/2026-11-04/round-nan-downstream.json b5d84a80a5a4640eca9ce04f232c0bc115503f34 · cells.A1