[Supplement] Original code, inverse code, complement code

Original code

For example,
the original code of +3: 0000 0011
The original code of -3: 1000 0011
The first bit of the original code is the sign bit,
0 is a positive number
-1 is a negative number

reverse code

For example,
the complement of +3: 0000 0011 (The original code of a positive number = the inverse code = the complement code)
The complement code of -3: 1111 1100 (The complement code of a negative number, except that the first sign remains unchanged, the remaining operating bits are all inverted.)

complement

For example;
+3’s complement: 0000 0011 (The original code of a positive number = the inverse code = the complement code)
-3's complement: 1111 1101 (+1 on the basis of the complement, every two is entered into one)

Precautions

Estimating from the complement to the original code is a similar process, first from the complement to the complement, and then from the complement to the complement.

Note: In computer systems, numerical values ​​are always represented and stored using complement codes.

Guess you like

Origin blog.csdn.net/qq_45657848/article/details/132142568