十进制数转换为十六进制数
Conversion of decimal number system into hexadecimal number system can be done by successively dividing an integral part by 16 till the quotient is 0 and then reading the remainder of all in the bottom to the top manner, where the bottom one is the MSB and the topmost is the LSB. For fractional part, we successively multiply it by 16 till we get 0 in the fractional part of the product term, the integral part of the product term recorded from top to bottom forms the respective hexadecimal number where topmost is the MSB.
可以通过将一个整数部分依次除以16直到商为0,然后从下到上依次读取所有的余数,从而将十进制数系统转换为十六进制系统 ,其中最低的是MSB,最高的是是LSB。 对于小数部分,我们将其连续乘以16,直到乘积项的小数部分得到0,从上到下记录的乘积项的整数部分形成相应的十六进制数,其中最高的是MSB。
To convert a mixed decimal number into hexadecimal, we will first convert integral and fractional parts into hexadecimal and then combine them.
要将混合的十进制数转换为十六进制 ,我们将首先将整数和小数部分转换为十六进制,然后将它们组合。
The only thing to be kept in mind is the digits in hexadecimal number system are as:
唯一要记住的是十六进制数字中的数字为:
1 , 2, 3, 4, 5, 6, 7, 8, 9, 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F
1、2、3、4、5、6、7、8、9、10 = A,11 = B,12 = C,13 = D,14 = E,15 = F
Now let’s take examples to understand the conversion of decimal number to hexadecimal number.
现在,让我们以示例了解十进制数到十六进制数的转换 。
Example 1:
范例1:
Convert (1954.785)10 to ( ? )16
将(1954.785) 10转换为(?) 16
Solution:
解:
Given decimal number (1954.785)10 is of mixed type and contains both integral (1954)10 and decimal part (0.785)10. To convert the given number into hexadecimal, we have to convert integral and fractional part individually into hexadecimal and then combine them together to get the required result.
给定的十进制数(1954.785) 10是混合类型,并且包含整数(1954) 10和十进制部分(0.785) 10 。 要将给定数字转换为十六进制,我们必须将整数和小数部分分别转换为十六进制,然后将它们组合在一起以获得所需的结果。
Integral Part
整体部分
Divisor | Quotient | Remainder |
---|---|---|
16 | 1954 | |
16 | 122 | 2 LSB |
16 | 7 | 10 = A |
16 | 0 | 7 MSB |
除数 | 商 | 余 |
---|---|---|
16 | 1954年 | |
16 | 122 | 2 LSB |
16 | 7 | 10 = A |
16 | 0 | 7个MSB |
The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (1954)10 = (7A2)16.
从下到上读取的余数给出等效的十六进制数,即(1954) 10 =(7A2) 16 。
Fractional Part
小数部分
0.785 * 16 = 12.56 = C.56 (MSB)
0.56 * 16 = 8.96
0.96 * 16 = 15.36 = F.36
0.36 * 16 = 5.76
0.76 * 16 = 12.16 = C.16 (LSB)
The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.785)10 = (0.C8F5C)16.
从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.785) 10 =(0.C8F5C) 16 。
After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (1954.785)10 = (7A2.C8F5C)16.
将整数部分和小数部分分别转换为十六进制后,现在我们将两者结合起来即可得到所需的结果,即(1954.785) 10 =(7A2.C8F5C) 16 。
Example 2:
范例2:
Convert (3283.715)10 to ( ? )16
将(3283.715) 10转换为(?) 16
Solution:
解:
Integral Part
整体部分
Divisor | Quotient | Remainder |
---|---|---|
16 | 3283 | |
16 | 205 | 3 LSB |
16 | 12 | 13=D |
16 | 0 | 12=C MSB |
除数 | 商 | 余 |
---|---|---|
16 | 3283 | |
16 | 205 | 3 LSB |
16 | 12 | 13 = D |
16 | 0 | 12 = C高位 |
The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (3283)10 = (CD3)16.
从下到上读取的余数给出等效的十六进制数,即(3283) 10 =(CD3) 16 。
Fractional Part
小数部分
0.715 * 16 = 11.44 = B.44 (MSB)
0.44 * 16 = 7.04
0.04 * 16 = 0.64
0.64 * 16 = 10.24 = A.24 (LSB)
The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.715)10 = (0. B70A)16.
从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.715) 10 =(0. B70A) 16 。
After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (3283.715)10 = (CD3. B70A)16.
在将整数部分和小数部分分别转换为十六进制之后,现在我们将两者合并以获得所需的结果,即(3283.715) 10 =(CD3。B70A) 16 。
Example 3:
范例3:
Convert (356.225)10 to ( ? )16
将(356.225) 10转换为(?) 16
Solution:
解:
Integral Part
整体部分
Divisor | Quotient | Remainder |
---|---|---|
16 | 356 | |
16 | 22 | 4 LSB |
16 | 1 | 6 |
16 | 0 | 1 MSB |
除数 | 商 | 余 |
---|---|---|
16 | 356 | |
16 | 22 | 4 LSB |
16 | 1个 | 6 |
16 | 0 | 1个MSB |
The remainders read from bottom to top gives the equivalent hexadecimal number i.e., (356)10 = (164)16.
从下到上读取的余数给出等效的十六进制数,即(356) 10 =(164) 16 。
Fractional Part
小数部分
0.225 * 16 = 3.600 (MSB)
0.600 * 16 = 9.600
0.600 * 16 = 9.600
0.600 * 16 = 9.600 (LSB)
The integer part of the product term read from top to bottom forms the equivalent hexadecimal number i.e., (0.225)10 = (0.39)16.
从上到下读取的乘积项的整数部分形成等效的十六进制数,即(0.225) 10 =(0.3 9 ) 16 。
After converting both integral part and fractional part individually into hexadecimal, now we combine both to get our desired result i.e., (356.225)10 = (164.39)16.
在将整数部分和小数部分分别转换为十六进制之后,现在我们将两者结合以获得所需的结果,即(356.225) 10 =(164.3 9 ) 16 。
十进制数转换为十六进制数