Question: Is there a command that will count the number of digits in a binary number in binary representation? Example: 10110 has 5 digits.

Is there a command that will count the number of digits in a binary number or any number for that matter? For example: 10110  has 5  digits in binary representation.

restart

I choose to define a number in base 10.

number := 22

22

(1)

Then I choose to convert that number into base 2.

number_binary := convert(number, binary)

10110

(2)

On visual inspection it is determined that number_binary has 5 digits in binary representation.

Is there a common command that can count the number of digits in a binary number? Such as, 10110 has 5 digits.

Download Count_digits_in_a_binary_number.mw

Count_digits_in_a_binary_number.mw

Please Wait...