What are the uses of the original code inverse code complement?

What is the use of original inverse complement

With complement, you can simplify the hardware by converting subtraction to addition operations.

Original and inverse codes, do not have this function, so, in computers, they are not used.

Original and inverse codes, therefore, are of no use.

——

For a two-digit decimal number, minus one, you can use +99 instead.

25 – 1 = 24

25 + 99 = (1) 24

Ignoring the rounding, and taking only two digits of the result, with both algorithms, the function is just the same.

99, then, is called: “the complement of -1”. 99=100-1.

For binary, it’s called: complement.

The eight-bit complement of -1 is: 256-1=255=11111111 (in binary).

——

With the help of the complement, it is possible to add, instead of subtract operations.

This is where the complement is useful.

Computer’s complement operation in the computer, what is the role of the complement?

Complementary operations can be used to determine whether the result of a computation is overflowed or not by the difference between the highest and second highest bits of the progression.

There are three ways to represent signed numbers in a computer, namely, original, inverse, and complement. All three representations of the sign bit and the value of the two parts of the sign bit are used to indicate that the 0 “positive”, with 1 to indicate that the “negative”, and the value of the bit, the three representations are different.

In the computer system, numerical values are always expressed and stored in complementary code. The reason for this is that by using the complement, the sign bit and the numeric field can be handled in the same way; at the same time, addition and subtraction can also be handled in the same way.

The complement of a positive integer is its binary representation, the same as the original.

Example: the complement of +9 is 00001001. (Note: the complement of +9 is expressed in 8-bit binary.) There are many ways to express the complement, including 16-bit binary complement, 32-bit binary complement, and 64-bit binary complement. Each of these complementary code representations can only represent a limited number of digits.)

Negative numbers:

To find the complement of a negative integer, invert all bits of the original code except the sign bit (0 to 1, 1 to 0, the sign bit remains unchanged at 1), and then add 1.

The same number is different in different complementary code representations. For example, the complement of -15 is 11110001 in 8-bit binary, however, in 16-bit binary complement representation, it is 111111111111110001. 8-bit binary is used for all the following.