FN-ROUNDUP-001: ROUNDUP, ROUNDDOWN and TRUNC read num_digits from its low 16 bits
Excel differs from the mathematical answer · measured · recorded 2026-11-04
ROUNDUP, ROUNDDOWN and TRUNC take the digit count from the low 16 bits of the integer part of |num_digits|, with the sign of num_digits. If |num_digits| is 2^32 or more, or those low bits are 32768 or more, the truncation happens at 100 places (10^-100, or 10^100 for a negative count). So 65536 acts as 0, 65537 as 1, 32768 to 65535 as 100, and -2147483748, whose low 16 bits are 100, as -100. In the out-of-range case ROUNDUP adds no unit for a positive count, and gives #NUM! for a negative count when a digit is dropped.
| Call and input route | Inputs | Excel | Correct value | Recorded in |
|---|---|---|---|---|
ROUNDUP(1.234567890123456e-200, 65536)cell-value2 | number: 1.234567890123456e-2000x166e3d71f622be8fnum_digits: 655360x40f0000000000000 | 10x3ff0000000000000 | 1.234567890123456e-2000x166e3d71f622be8f | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
ROUNDUP(1.234567890123456e-200, 65537)cell-value2 | number: 1.234567890123456e-2000x166e3d71f622be8fnum_digits: 655370x40f0001000000000 | 0.10x3fb999999999999a | 1.234567890123456e-2000x166e3d71f622be8f | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
ROUNDUP(1.234567890123456e-200, 32768)cell-value2 | number: 1.234567890123456e-2000x166e3d71f622be8fnum_digits: 327680x40e0000000000000 | 00x0000000000000000 | 1.234567890123456e-2000x166e3d71f622be8f | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
TRUNC(1.234567890123456e-200, 65536)cell-value2 | number: 1.234567890123456e-2000x166e3d71f622be8fnum_digits: 655360x40f0000000000000 | 00x0000000000000000 | 1.234567890123456e-2000x166e3d71f622be8f | Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture |
Correct value: The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.
Correct value: The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.
Correct value: The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.
Correct value: The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.
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. All 13,914 informative ROUNDDOWN and TRUNC rows with large num_digits follow the rule.
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-roundup.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-ROUNDUP-00041
- CalcFunc-Evidence · runs/w111-rounding-count-refinement-20260929/answers-roundup.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-ROUNDUP-00043
- CalcFunc-Evidence · runs/w111-rounding-count-refinement-20260929/answers-roundup.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-ROUNDUP-00033
- CalcFunc-Evidence · runs/w111-rounding-count-refinement-20260929/answers-trunc.json.gz 4d5320dfdc385354469b4d506153357bb932ab08 · w111roundcount-TRUNC-00041