I. Original code, anti-code, complement calculation method. 1. Original code
The original code is the absolute value of the symbolic bit plus the truth, that is, the first digit represents the symbol, and the remaining bits represent the values. For example, if it is a 8-bit binary:
[+1] original = 0000 0001
[-1] original = 1000 0001
The first bit is the sign bit. Because the first bit is the sign bit, the range of values for the 8-bit binary number is:
[1111 1111, 0111 1111]
That
[-127, 127]
2. Anti-code
The inverse code is represented by:
The inverse of a positive number is its own
Negative number of the inverse code is on the basis of its original code, the sign bit is unchanged, the remaining bits are reversed.
[+1] = [00000001] original = [00000001] Reverse
[-1] = [10000001] original = [11111110] Reverse
It can be seen that if an inverse code represents a negative number, the human brain cannot visually see its value. It is usually converted to the original code and then calculated.
3. Complement
The complement is expressed in the following ways:
A positive complement is its own
The complement of a negative number is on the basis of its original code, the sign bit is unchanged, the rest of you take the counter, the last +1. (That is, on the basis of the anti-code +1)
[+1] = [00000001] original = [00000001] counter = [00000001] Complement
[-1] = [10000001] original = [11111110] counter = [11111111] Complement
Original code, anti-code, complement calculation method