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.
Example 1105Converts the binary number 110.11 to a decimal number.
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
Example 1107Converts (173) 10 to a binary number.
Solution:
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 1108 converts (0.8125) to binary decimals.
Solution:
Example 1109(173.8125) 10= () 2
Solution:by [Example 1107] (173) 10= (10101101) 2
by [Example 1108] (0.8125) 10= (0.1101) 2
combine integral and fractional parts: (173.8125) 10= (10101101.1101) 2
Reference: http://zyk.thss.tsinghua.edu.cn/29/elecTec/resource/knowledge/zsd11/z1103.htm
Decimal decimals are converted into binary decimals using the "Multiply 2 rounding, order" method. The specific method is: with 2 times decimal decimals, you can get the product, the integral part of the integer, and then 2 by the remainder of the fractional part, and then get a product, and then the integral part of the integer is taken out, and so on, until the integer part of the product is zero, or the whole number is divided into 1, when 0 or 1 Or to achieve the required accuracy.
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.
Decimal decimal to binary binary
such as: 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
Again such as: 0.7= (0.1 0110 0110 ...) B
0.7*2=1.4======== take out the integer part 1
0.4*2=0.8======== take out the integer part 0
0.8*2=1.6======== take out the integer part 1
0.6*2=1.2======== take out the integer part 1
0.2*2=0.4======== take out the integer part 0
0.4*2=0.8======== take out the integer part 0
0.8*2=1.6======== take out the integer part 1
0.6*2=1.2======== take out the integer part 1
0.2*2=0.4======== take out the integer part 0
Reference: http://whudongyang.iteye.com/blog/1208120
Conversions between decimal decimals and binary decimals