2 ms·
> I'd start with a 20 character buffer (because int64 will never need more) Just in case anyone is wondering, this is because the maximum number of decimal dig
by matheusmoreira 2y ago
> I'd start with a 20 character buffer (because int64 will never need more)
Just in case anyone is wondering, this is because the maximum number of decimal digits for a given number of bits is given by:
digits(bits) = ceil(bits * log10(2))
This can be generalized to any number of bits.
digits(32) = 10
digits(64) = 20
digits(128) = 39
digits(256) = 78
digits(512) = 155
digits(1024) = 309