How Binary Coded Decimal, how to transfer binary decimal

1, the computer system of the number of presentation

Number system: counting method refers to a method and symbol uniform set of rules to represent the fixed value

Digit: refers to the position of the digital sign is located in a number of

Base: refers to some binary notation, the number of digits of the digit symbols that can be used

Bit weights: refers to some binary notation, the number of bits represent the size, i.e. in the size of the value indicated on a bit "1."

2, number system representation

 

3, the system calculates the number of

 

4, conversion between hex

4.1, a positive integer binary decimal conversion

A decimal number divided by two, then divided by two to get the business, and so on until the quotient is equal to one or zero so far, to take down the quotient obtained by dividing the remainder, namely in terms of the result of a binary number. Just remember key points: In addition to more than two takes, in reverse order.

Since the internal computer units are represented by the number of bytes of fixed length, expanded in powers of 2, or 8, or 16, or 32 ..... So, when the computer is represented by a binary number, the number of bits is insufficient power of 2, to make up for the high number of 0. In this paper are an example to eight.

 

 

  Negative integer into a binary

        Method: After a positive integer corresponding to the first converted into binary, the binary negated, then the result plus one. Also in Example 42, a negative integer is -42, as shown in Figure 4 explains the method. Last namely: (- 42) = 10 (11010110) 2.

             二进制如何转十进制,十进制如何转二进制

 

Decimal to binary conversion method: after the decimal point of the number multiplied by 2, a result of it, to take the integer part (either 1 or 0 myself), and then multiplied by the fractional part 2, and then take the integer part ...... and so on until the fractional part is zero or the number of bits is enough to OK. Then take the integer part are arranged according to the sequence is OK, the binary sequence constitutes the fractional part, for example bar, such as 0.125, as shown in FIG.

            二进制如何转十进制,十进制如何转二进制

  1. How to convert if the integer part of a decimal integer greater than 0 have it? As described above into a binary integer, decimal to binary conversion, and then added together to OK, as shown in FIG.
    二进制如何转十进制,十进制如何转二进制

4.2, binary to decimal

Binary decimal conversion principle: from a first binary number to the right of the start of each power of 2 multiplied by n, n from 0 and increments by one. Each number was out then adding i.e. a decimal number.

 

 

 

4.3, decimal to hexadecimal

 

4.4, hexadecimal to decimal (this is no longer shows a process, not used)

十六进制数转十进制数方法:十六进制数按权展开,从十六进制数的右边第一个数开始,每一个乘以16的n次方,n从0开始,每次递增1。然后得出来的每个数相加即是十进制数。

4.5、二进制转十六进制(这里不再展示过程,不常用)

方法为:与二进制转八进制方法近似,八进制由三个二进制数表示,十六进制是四个二进制数表示。(注意事项,4位二进制转成十六进制是从右到左开始转换,不足时补0)。

4.6、十六进制转二进制(这里不再展示过程,不常用)

方法为:十六进制数通过除2取余法,得到二进制数,每个十六进制数为4个二进制数表示,不足时在最左边补零。

Guess you like

Origin www.cnblogs.com/xiao-lei/p/10961068.html