What is the decimal to binary conversion formula?

Decimal to binary formula: abcd.efg(2)=d*2⁰+c*2¹+b*2²+a*2³+e*2-¹+f*2-²+g*2-³(10).

Divide a decimal number by two, and the resulting quotient is then divided by two, and so on until the quotient equals one or zero, and then take the remainder of the division, which is the result of converting to binary. Just remember the key points: divide by two and take the remainder, in reverse order.

Because the byte unit inside the computer to represent the number are fixed-length, to the power of 2 to expand, or 8-bit, or 16-bit, or 32-bit ….. Thus, a binary number is represented by a computer with fewer bits than a power of 2, and a number of zeros are made up in the higher bits.

Example:

E.g. 255 (decimal)=11111111 (binary)

255/2=127===== remainder 1

127/2=63====== Remaining 1

63/2=31======= Remaining 1

31/2=15======= Remaining 1

15/2=7======== Remaining 1

7/2=3========= Remaining 1

3/2=1========= Remaining 1

1/2=0= ======== remainder 1

E.g. 789=1100010101

789/2=394.5=1 10th place

394/2=197=0 9th place

197/2=98.5=1 8th place

98/2=49=0 7th place

49/2 =24.5=1 bit 6

24/2=12=0 bit 5

12/2=6=0 bit 4

6/2=3=0 bit 3

3/2=1.5=1 bit 2

1/2=0.5=1 bit 1

Above references Baidu Baiku – Decimal to Binary

### Decimal binary conversion formula

The formula for converting decimal to binary is: x10=i=0∑nai×2i where x10 is the decimal number, ai is the ith digit of the binary number (counting from the right to the left), and n is the number of digits of the binary number minus one.

1, decimal to binary conversion

Based on the above formula, we can get a decimal to binary conversion method,

Divide the decimal number by 2 to get the quotient and remainder.

Take the remainder as the lowest (rightmost) bit of the binary number.

Continue dividing the quotient by 2 and repeat until the quotient is 0.

Arrange all the resulting remainders in order from lowest to highest (right to left) to get the corresponding binary number.

2. Examples of conversion from decimal to binary

The following are some examples of conversion from decimal to binary:

The binary number corresponding to 2510 is 110012.

The binary number corresponding to 10010 is 11001002.

The binary number corresponding to 25510 is 111111112.

The binary number corresponding to 25510 is 111111112. 1111111112.

3.1410 The corresponding binary number is 11.001000111101011100001010001111012 (32 decimal places reserved).

Conversion Between Other Binary Systems

1. Conversion Between Octal and Binary

There is a simple relationship between octal and binary, which is that every three binary digits can correspond to one octal digit and vice versa. Therefore, the conversion between octal and binary can be done in the following way:

Converting an octal number to a binary number: each octal number is represented by three binary digits, which are then connected in sequence, with the decimal point in the same position.

2, the conversion between hexadecimal and binary

Hexadecimal and binary also have a simple relationship between every four binary digits can correspond to a hexadecimal number, and vice versa. Therefore, the conversion between hexadecimal and binary can be done in the following way:

Converting a hexadecimal number to a binary number: each hexadecimal number is represented by a four-digit binary number, which is then connected in order, with the decimal point in the same position.

3. Conversion Between Decimal and Other Binary Systems

Converting Decimal Numbers to Other Binary Systems: Divide the decimal number by the base of the target base (e.g., the base of 8 for octal) to get the quotient and remainder. Use the remainder as the lowest (rightmost) bit of the target binary.

Continue dividing the quotient by the base of the target decimal, repeating the above steps until the quotient is zero. Arrange all the resulting remainders in order from the lowest to the highest bit (right to left) to get the corresponding number of the target binary.

### Decimal to Binary Formula

To give an example:

Convert 25 in decimal to a binary number.

25/2=12….. .1 (remainder)

12/2=6….. .0

6/2=3….. .0

3/2=1….. .1

1/2=0….. .1

Then we write the remainder in order from the bottom up as: 11001, so this 11001 is the binary form of decimal 25

### Decimal number to binary number table

2 to 10: 1011 (binary) = 1x2x2x2+0x2x2+1×2+1=11 (decimal), binary addition: 1101+1011=11000, decimal to binary: decimal number divided by 2 to take the remainder of the quotient, the quotient and then divide by 2 and take the remainder until the remaining 1 divided by 2 to take the remainder of the quotient of 1 0 so far! and then the remainder of the inverse row is the binary number, remember that during the period there is no remainder to be used to make up for the remainder of 0, binary shrink twice (this sentence is the wrong statement, shrinking is a fraction of the expansion of the multiplier is a multiple of the number of times, I’ll treat you as shrinking one-half): 1101×1/2 = (110.1×2) x1/2 = 110.1, hexadecimal to binary: hexadecimal number can be converted to 4-bit binary: hexadecimal number of each bit converted to 4-bit binary: 1e(hex)=0001

1101, where 1 pairs 0001 and e pairs 1101