one or two binary number converted to decimal number
The basic practice of converting a binary number to a decimal number is to first write the binary number as the weighted coefficient expansion, and then sum it by the decimal addition rule. This practice is known as the "weighted addition" method.
two or 10 binary number converted to binary number
When a decimal number is converted to a binary number, the integer and fractional parts of the decimal number are converted before merging because of the different conversion methods of integers and decimals.
1. Decimal integers are converted to binary integers
A decimal integer is converted to a binary integer using the "except 2, reverse orderLaw The practice is: with 2 to remove the decimal integer, you can get a quotient and the remainder, and then 2 to remove the quotient, and then get a quotient and the remainder, so that until the quotient is 0 o'clock, and then the first obtained remainder as a binary number of the low-effective bit, the remainder as a binary number of the high-level effective bit, arranged in order
2. Decimal decimals converted to binary decimals
Decimal decimals are converted into binary decimals using the "multiply by 2, arrange in orderLaw The specific method is: with 2 times decimal decimals, you can get the product, the integral part of the integer out, and then 2 by the remainder of the fractional part, and get a product, and then the integral part of the product is taken out, so, until the fractional part of the product is divided into 0, or to achieve the required precision.
The integer part is then sorted in order, the first integer as the high-effective bit of the binary decimal, followed by the integer as the low-effective bit.
Example 1109 (173.8125) 10= () 2
Solution:by [Example 1107] (173) 10= (10101101) 2
by [Example 1108] (0.8125) 10= (0.1101) 2
Combine integer and Fractional parts: (173.8125) 10 = (10101101.1101) 2
Decimal decimal →→→→→ Binary decimal method: "Take 2 Rounding"
The integer part and fractional part of the decimal decimal number multiply by 2, the integer part is both the corresponding binary numeral, and then 2 times the fractional part (the new fractional portion is obtained after the multiplication), and the integer and decimal parts are obtained.
This is repeated until the decimal part is 0 or the accuracy requirement is reached. The first one gets the highest bit, the last time to get the lowest bit
For example: 0.25 binary
0.25*2=0.5 Rounding is 0
0.5*2=1.0 Rounding is 1
That is, 0.25 of the binary is 0. ( the first to get the highest bit, the last to get the lowest bit)
Binary in 0.8125
0.8125*2=1.625 Rounding is 1
0.625*2=1.25 Rounding is 1
0.25*2=0.5 Rounding is 0
0.5*2=1.0 Rounding is 1
That is, 0.8125 of the binary is 0. 1101(the first to get the highest bit, the last to get the lowest bit)
Decimal decimal →→→→→ Octal decimal method: "Take 8 rounding"
0.71875) 10 = (0.56) 8
0.71875*8=5.75 Rounding 5
0.75*8=6.0 Rounding 6
That is 0.56
Decimal decimal →→→→→ Hexadecimal decimal method: "Take 16 rounding" for example:
(0.142578125) 10 = (0.248) 16
0.142578125*16=2.28125 Rounding 2
0.28125*16=4.5 Rounding 4
0.5*16=8.0 Rounding 8
That is 0.248
Conversions between non-decimal numbers
(1) Conversion between binary number and octal number
The conversion method is: A decimal point, respectively, to the left and right each three -bit binary number to synthesize an octal number, or each octet number to show three-bit binary number, less than three to fill 0. For example:
(423. 45) 8 = (100 010 011.100 101) 2
(1001001.1101) 2 = (001 001 001.110 100) 2 = (111.64) 8
(2) binary and 16 binary conversions
Conversion method: The decimal point, respectively, to the left and right each four -bit binary synthesis of a hexadecimal number, or each digit hexadecimal number to show four-bit binary number, less than four to fill 0. For example:
(ABCD.EF) 16 = (1010 1011 1100 1101.1110 1111) 2
(101101101001011.01101) 2= (0101 1011 0100 1011.0110) 2= (5b4b.68) 16
You can use the binary as the intermediate transition.
Conversions between decimal decimals and binary decimals