MM PP - 9 months ago 38

C++ Question

Someone asked me to determine how many digits does a number in base 2 has, when you know the number in base 10.

Is there any method to determine the number of digits of the number in base 2 without converting the number from base 10 to base 2?

At this moment I know only how to determine the number of digits of a number when converted to base 2, only if I compute the number in base 2.

Thank you!

Answer Source

I may be wrong, but since a binary number of *n* bits can represent a maximum decimal number of *2 ^{n} - 1*, I would guess that a decimal number