3 ms·
But why convert it to binary? If you store the number as an array of digits the parsing process should be O(n).
by bjourne 4y ago
But why convert it to binary? If you store the number as an array of digits the parsing process should be O(n).
- lifthrasiir 4y agoThat means every limb operation should be done modulo 10^k, which would be pretty expensive and only makes sense if you don't do much computation with them so the base conversion will dominate the computation.
- thehappypm 4y agoAre you asking why computers store numbers in binary?
- bjourne 4y agoNo. Many bignum libraries store numbers as sequences (or linked lists) of "digits", where each digit is an 8 to 256-bit binary number. Which is why I'm skeptical of lifthrasiir's claim that a bignum cannot be parsed in O(n) since it is analogous to initializing a list.