Re: How to convert binary to BCD ?
Posted: Sat Jan 26, 2013 3:19 am
The maximum number which can show in 26-bits is (226 - 1) = 67108863Why 26 bit ? Cant represent more than 26 bit numbers ?
Is Reason for limit ,for 32 bit output?
There are 8 digits which needs 8 nibbles of 4 bytes.
Now consider (227 - 1)... it is 134217728 and it has 9 digits.
It needs 9 nibbles. That is 4-bytes and another nibble which can't be accommodated in a 32-bit integer type.
So for your question, answer is yes.
If you select the return type to be a 64-bit type such as long long or __int64, then you can represent 16-digits with those.