### How is the conversion between the original code, the complement and the inverse code?

One, the positive integer’s original code, inverse code, complement code is exactly the same, that is, the sign bit is fixed to 0, the value bit is the same.

Two, the sign bit of the negative integer is fixed to 1, from the original code into the complement, the rules are as follows:

1, the original code sign bit 1 remains unchanged, the integer binary digit of each inverse, to get the inverse code.

2, the inverse code sign bit 1 unchanged, the inverse code value bit of the lowest bit plus 1, to get the complementary code.

Methods:

(1) Calculate the original code, inverse code and complement of a positive integer. [Sign bit is 0, original code=inverse code=complement]

(2) Calculate the original code, inverse code and complement of a negative integer, first find the original code, then the inverse code, and finally the complement.

(3) according to the complement of the truth value, generally use the formula in the figure to calculate, positive integer symbols for +, negative integer symbols for -, usually after completing the complement of the truth, you can press step 1, 2 simple inverse deduction, to see whether the results are correct.

Extended information:

Representation of the complement:

The concept of modulus: a unit of measurement is called a modulus or modulus. For example, a clock counts cycles in base 12, i.e., modulo 12. On a clock, the position of the hour hand remains unchanged by adding (forward dialing) an integer number of digits to 12 or subtracting (reverse dialing) an integer number of digits from 12. 14 o’clock becomes (p.m.) 2 o’clock after rounding off modulo 12 (14 = 14 – 12 = 2).

Dialing 10 frames counterclockwise from 0 o’clock means subtracting 10 hours, which can also be viewed as dialing 2 frames clockwise from 0 o’clock (plus 2 hours), i.e., 2 o’clock (0-10 = -10 = -10 + 12 = 2). Thus, with modulo 12, -10 can be mapped to +2. It follows that adding 2 has the same effect as subtracting 10 for a recurring system modulo 12.

So, in a system modulo 12, any operation that subtracts 10 can be replaced by adding 2, which converts the subtraction problem into an addition problem (note: computers have only adders in their hardware architecture, so most operations must eventually be converted to additions). 10 and 2 are complements of each other for modulo 12.

Similarly, the computer’s arithmetic components and registers are limited to a certain word length (assuming a word length of 8), so their operations are modulo arithmetic. When the counter reaches the full 8-bit limit, that is, 256 digits, it overflows and starts counting again from the beginning. The amount of overflow is the modulus of the counter, obviously, 8-bit binary number, its modulus is 2^8 = 256. In the calculation, the two complementary numbers are called “complementary code”.

### What is the original inverse complement of each of the eight digits of the decimal number -96

[-96] original = 11100000;

[-96] inverse = 10011111;

[-96] complement = 10100000.

——— —-

In computer systems, numerical values, invariably, are represented and stored using the complement.

Original and inverse codes, both are useless and neither exists.

Just master the “numerical value and complement” conversion, can be.

The relationship between them can be seen in the following table:

Negative numbers, plus 256, and then into binary.

No need to discuss the “original code inverse plus one sign bit unchanged”.

The foreigners can’t do arithmetic, that’s why they use these operations.