Compute the number of digits an integer needs in a target radix (2-36), comparing binary and hex compactness.
支持 2-36 进制。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Digit count | Digits = ⌊logbN⌋ + 1 for N > 0 with target radix b | ISO 80000-2:2019 Quantities and units — mathematics |
| Bit mapping | Each hex digit holds 4 bits, each octal digit 3 bits, each binary digit 1 bit | Knuth, TAOCP Vol. 2 §4.1 Positional Number Systems |
| Conversion precision | Conversions must stay in integer arithmetic; floating-point log is only for length estimates | IEEE 754-2019 Standard for Floating-Point Arithmetic |