Data Representation-source code, reverse code, complement code, transfer code, and reverse Code complement
So far, we have learned the numbers used in decimal, binary, octal, and hexadecimal notation to represent the actual values. These numbers are called true values, which we will use in our daily lives, how is the value represented in the computer?
The representation of a number in a computer is collectively referred to as the number of machines. Data processing and computation in a computer are both binary. Generally, the number of machines is represented in eight bits. Practical Data has positive and negative numbers, because the computer can only represent 0 and 1 states, and the positive or negative values of the data are "+", in a computer, it is distinguished by a binary value of 0 or 1, which is usually placed in the highest bit and becomes the symbol bit. After the number of symbols is converted into numeric values, the computer has designed a variety of symbol bit encoding methods to conveniently perform arithmetic operations on the number of machines and improve the computing speed, the most common methods for expressing the number of machines are: source code, reverse code, complement code, and transfer code. The following describes their representation methods respectively.
I. source code, reverse code, and complement code
The conversion process of the Three Representations is as follows:
Note:
In particular, 0 has two Representation Methods: [+ 0] original = 0000000, [-0] original = 1000000.
In the anticode representation, 0 also has two forms: [+ 0] = 0000000, [-0] = 11111111.
In the complement representation, 0 has a unique encoding: [+ 0] fill = 0000000, [-0] fill = 0000000.
Ii. Code Transfer
Because it is difficult for individuals to understand the QR code, so can explain it separately:
The bitwise representation is defined by adding an offset to the number X. It is usually used to represent the order code in the floating point number, so it is an integer. If the machine word length is n, the specified offset is 2 ^ (n-1 ). If X is an integer, [X] is shifted to 2 ^ (n-1) + X
Then [+ 45] = + 0101101 + 10000000, [-45] =-0101101 + 10000000 = 01010011
In fact, this can be introduced. In the case of 2 ^ (n-1) offset, you only need to reverse the signed bits of the complement code to obtain the corresponding shift code representation.
Note: In the transfer code representation, 0 is also encoded in the same way. [+ 0] shift = 1000000, [-0] shift = 1000000.
The computer uses these encoding methods to facilitate computation and increase the computation speed. The four representation methods are actually progressive, that is, the binary representation of the decimal number is obtained. Remember the positive and negative representation of the symbol bit and know how to carry the relationship between them.
This blog only describes the representation of the source code, the reverse code, the complement code, and the transfer code. But why does the computer need to represent the data like this? Please make up the next analysis ...... (^_^)
The original code representation of the decimal number-113, reverse code representation, complement representation and shift Representation
The original code 11110001 is 1, and the original code of 113 is obtained. In addition to 2, write down the remainder, and in addition to 2, write down the remainder. The remainder is the original code from the back to the front, plus the symbol bit.
2 113
2 56 1
2 28 0
2 14 0
2 7 0
2 3 1
2 1 1
2 0 1 so the original code is 1110001, with the symbol bit 11110001
The anti-code 10001110. Except for the symbol bit, the original code is reversed by the other bitwise, And the symbol bit remains unchanged.
Fill in 10001111, and Add 1 to the anti-code.
The bitrate is 00001111, And the bitrate is reversed.
It is recommended that you go to the programming module next time to ask such questions. If the Mathematical Module understands the computer, it may not be able to see such questions.
Source code anti-Code complement
Note: D is the decimal ending mark, and B is the binary ending mark.
-27/32 =-0.84375D =-0.11011B
(8 digits) source code: 1.1101100
Anti: 1.0010011
Supplement: 1.0010100
No decimal number