Existing relationship: 1. The complement of a negative number is the inversion of all bits of the original code except the sign bit, and then the lowest bit is added by 1; 2. The complement of a positive number is the same as its original code; 3. Negative numbers The complement of can be obtained by using the positive original code 1.
There is the following relationship between the complement of a negative number and the original code:
For example, find the complement of -5: The positive number corresponding to
Therefore, the relationship between the complement of a negative number and the original code is: the complement of a negative number is the inversion of all bits of the original code except the sign bit, and then adding 1 to the lowest bit.
The above is the detailed content of The relationship between the complement of negative numbers and the original code. For more information, please follow other related articles on the PHP Chinese website!