FN-ROUND-001: ROUND counts digits in 32 bits, and the count wraps
Excel differs from the mathematical answer · measured · recorded 2026-11-04
ROUND cuts num_digits toward zero to a 32-bit integer D, limited to +/-2147483647, and keeps k = D + e + 1 significant digits, where e is the decimal exponent of |number| and the sum is computed in 32 bits. k of 15 or more keeps the 15-digit reading of the number; k below 0 gives 0. A large positive num_digits therefore wraps to no digits at all: for a number near 1.1E14, 2147483617 returns the number and 2147483635 returns 0. The boundaries move by exactly -e on both the +2^31 and -2^31 sides, for e from -308 to 308. num_digits of 2^31 or more acts as +2147483647 and -2^31 or less as -2147483647.
| Call and input route | Inputs | Excel | Correct value | Recorded in |
|---|---|---|---|---|
ROUND(-112500000000000, 2147483635)cell-value2 | number: -1125000000000000xc2d9945ca2620000num_digits: 21474836350x41dffffffcc00000 | 00x0000000000000000 | -1125000000000000xc2d9945ca2620000 | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
ROUND(-112500000000000, 2147483617)cell-value2 | number: -1125000000000000xc2d9945ca2620000num_digits: 21474836170x41dffffff8400000 | -1125000000000000xc2d9945ca2620000 | — | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
Correct value: -112500000000000 is an integer, so rounding it to any non-negative number of places returns it.
Basis: Under the family rules the recorded rows match ROUND 36,821 of 36,945, ROUNDUP 52,022 of 52,841, ROUNDDOWN 59,182 of 59,995 and TRUNC 50,504 of 51,317, with no row lost and each remaining failure classified in the write-up. The wrap boundary was read at every decimal exponent in the recorded rows.
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/rounding-EVIDENCE.md b5d84a80a5a4640eca9ce04f232c0bc115503f34 · research write-up: full-bank result, the rules, what stays open
- CalcFunc-Evidence · runs/w111-rounding-count-refinement-20260929/answers-round.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-ROUND-01694
- CalcFunc-Evidence · runs/w111-rounding-count-refinement-20260929/answers-round.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-ROUND-01682