Home  >  Article  >  Convert decimal 50 to binary

Convert decimal 50 to binary

尚
Original
2019-06-11 10:19:3521391browse

Convert decimal 50 to binary

Decimal 50, converted to binary value is 110010.

Specific algorithm: 50/2=25 more than 0, 25/2=12 more than 1, 12/2=6 more than 0, 6/2=3 more than 0, 3/2=1 more than 1,1 /2=0 more than 1. Arrange the remainders in reverse order and the result is a binary number.

1. Convert decimal integer to binary integer:

Convert decimal integer to binary integer using the method of "divide by 2, take remainder, and arrange in reverse order".

The specific method is: divide the decimal integer by 2, you can get a quotient and remainder; then use 2 to divide the quotient, you will get a quotient and remainder, and so on, until the quotient is less than 1, and then The remainder obtained first is used as the low-significant bit of the binary number, and the remainder obtained later is used as the high-significant bit of the binary number, and they are arranged in sequence.

2. Convert decimals to binary decimals:

Convert decimals to binary decimals using the "multiplied by 2, rounded, and arranged in order" method. The specific method is: multiply the decimal number by 2 to get the product, take out the integer part of the product, then multiply the remaining decimal part by 2 to get another product, then take out the integer part of the product, and so on until the The decimal part is zero, and 0 or 1 is the last bit of binary. Or until the required accuracy is achieved.

Then arrange the extracted integer parts in order. The integer taken first is used as the high-order significant bit of the binary decimal, and the integer taken later is used as the low-order significant bit.

For example: 0.625=(0.101)B

0.625*2=1.25, take out the integer part 1;

0.25*2=0.5, take out the integer part 0;

0.5*2=1, take out the integer part 1.

Related recommendations:Convert binary numbers to decimal numbers

The above is the detailed content of Convert decimal 50 to binary. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn