Original code inverse code complement representation 0 to 10

What does the original, inverse, and complement mean in a computer

Signed numbers, which have three representations, namely, original, inverse, and complement.

In computer systems, values are always represented and stored in complement.

In a computer system, the original code and the inverse code, are not present.

==================

The value 0, in an eight-bit machine, is 00000000.

+1, that is, plus one, that is: 00000001.

+2, that is, plus one, that is: 00000010.

The other positive numbers, in order to increment it.

The last is +127, which is: 01111111.

——- —-

Negative numbers, that is, subtracting from 0 downwards.

Then, -1 is 00000000-1, and the result of taking eight digits,

is: 11111111 = 255 (decimal).

Similarly, -2 is 11111110=254.

The other negative numbers, in descending order, are sufficient.

The other negative numbers, in descending order, are sufficient.

The last is -128, which is: 10000000 = 128.

The above, is the numerical value, which exists as the complement in the computer.

To find the complement of a negative number, the formula is: [256 + this negative number].

If you need binary, transform it yourself.

==================

With the help of the complement, it is possible to convert a subtraction, into an addition operation.

This allows: simplifying the hardware of the computer.

E.g.: 59-31=28.

In a computer, the operation of addition with the complement is as follows:

59’s complement = 00111011

-31’s complement = 11100001

– Sum ——— —-

Gain: (1) 00011100 = 28’s complement

Keeping eight bits, the result is exactly correct.

This implements the subtraction operation.

Neither the original code, nor the inverse code, does this.

So, in computers, there is no such thing as an original code or an inverse code.

How to calculate the representation of the original code, complement, inverse code and shift code?

Original code is to convert the original number into binary

For example, the original code of 10 is 00001010, and the original code of +10 is 00001010, the 0 in the highest bit means

that the number is a positive number (the highest bit is the sign bit).

The original code of -10 is 10001010, and the 1 in the highest bit means that the number is negative

The original code of +10 is 00001010, and the inverse and complement of +10 are the same as the original code

and also 00001010, because the original

inverse

complement of a positive number is the same

The original code of -10 is 10001010, and the 0 in the highest bit means that it is positive (the highest bit is the sign).

The original code is 10001010, then his inverse code is 11110101, that is, the sign bit remains unchanged, and the other bits change from 0 to 1, and from 1 to 0.

His complement is based on the inverse code, and the lowest bit is increased by 1, that is, 11110110.

See what I mean?