Source code, anti-code, complement code, personal understanding, anti-Code complement
Original code:
Binary Fixed-point notation, that is, the highest bit is the symbol bit, "0" indicates a positive number, "1" indicates a negative number, and the remaining bit indicates the value size.
The maximum digit of a positive number is 0.
The maximum digit of a negative number is 1.
Example:
Symbol bit value
+ 7 0 0000111
-7 1 0000111
Anti-code:
The reverse code of a positive number is the same as the original code, and there is no change
Negative Inverse code: it remains the same as the original symbol bit, and other values are reversed, that is, 0 is changed to 1, 1 is changed to 0.
Example:
Symbol bit value
+ 7 0 0000111
-7 1 1111000
Complement:
The positive complement code is the same as the original code, and there is no change
The complement of negative numbers is based on the anticode plus 1
Example:
Symbol bit value
+ 7 0 0000111
-7 1 1111001
Summary:
Why is the range of a byte-128 ~ 127
One byte is 8 bits, that is, 00000000 (8 bits)
To distinguish between positive and negative numbers, a computer occupies a sign bit to indicate positive and negative, so the maximum number can only represent 1111111 (7 digits ),
The binary 1111111 is converted to the 10th hexadecimal notation + 127.
Ask... I understand it, right?