How it works
The input is parsed in its base and converted with arbitrary-precision integers (BigInt), so very large numbers stay exact instead of rounding like normal JavaScript numbers.
Accepted input
- Digits valid for the chosen base: 0-1 for binary, 0-7 for octal, 0-9 for decimal, 0-9 and a-f for hex.
- Optional prefixes
0b,0o,0x, a leading minus sign, and underscores or spaces as separators. - Integers only: fractions are not supported.
Negative numbers
Negative values are shown with a minus sign, not in two's complement. For fixed-width two's complement, convert the value modulo 2n yourself.