I'd like to sum numbers that range from small (1
) to very large (2**200
). For that, I thought of using base-32 or base-36, such that the largest number would occupy a reasonable string (2**200
becomes bnklg118cog0000000000000000000000000000
in base-36).
However, how can I sum 2**200
with 1
, for example? If I convert to decimal, it'll do 1.6069380442589901e+60 + 1
and the 1 will be ignored due to the precision. What I'd like is to do, for example:
bnklg118cog0000000000000000000000000000 + 1 = bnklg118cog0000000000000000000000000001
I know I can convert a number to base 36 using .toString(36)
, but summing them would sum strings, not giving the correct result.
Is it possible to do something like in hexadecimal, as (0xee + 0x11).toString(16) = "ff"
?