Complement:
Positive complement: the positive complement is the original code.
For example, the complement code of 4 is converted to a binary original code: 00000100. The complement code is the same as the original code, that is, 00000100.
Negative complement: The symbol bit is 1, the other bit is the original code of this value is reversed by bit, and then the entire number is added to 1
For example, the-4 complement code is converted to the binary original code: 1000100, bitwise reverse: 1111011, and the addition of 1 is: 1111100
Re-code to original code:
The source code of positive numbers is the same as the source code, that is, the source code is the source code itself.
The original code of the negative number is: the complement code is binary inverse + 1
Bitwise non-operation:
Set each 0-bit of the positive number operand to 1, and set each 1-bit to 0, resulting in a binary complement of a number. For any positive number ,~ X and-X-1 are the same.
Example:-4 bitwise non-, converted to binary original code: 10000100, bitwise reverse: 11111011, which is a complement code, converted to the original code (+ 1): 10000100, add 1 to 10000101, And the leftmost is the symbol bit. The positive number corresponding to the original code is-5.
N root:
The Npower root of M is equal to the 1/Npower of M.