for the complement has always only know the application method, is the positive complement is its own, the complement of negative numbers is its corresponding positive number of each to take the inverse plus one, so that the subtraction operation can be achieved by adding. But has not been very clear about its principle, today to break apart and knead a chat.
The complement is derived from the concept and method of mathematical complement, so the understanding of complement must first understand the complement.
Number of complements
The definition of a complement (radix comletment): There is a number with a base of B, and a digit of n is the complement of the y,y of B minus Y. For example, the cardinality is 10, and the complement of three digits 123 is 877 (1000-123).
The definition of reduced radix complement (diminished radix complement): B's N-th minus 1 minus y. For example, a base number of 10,123 is a reduction base complement of 876 (1000-1-123).
Why is there a reduction in the cardinality of the complement, because it is more convenient to calculate. Mathematically it can be proved that the N-square minus 1 minus y of B can be obtained, and each digit of y is subtracted by b-1. For example, the above example, 9 (10-1) -1,9-2,9-3 can be obtained by the reduction of the number of Y-complement of the hundred, 10-bit and digit. As for and proof, you can Google yourself.
The principle of subtraction addition can be realized
There are two ways to implement subtraction with addition.
The first is to use the reduction base complement of X plus y to get an X-y reduction base complement.
The second, X plus Y's complement can get an X-y value.
Cond...
My level is limited, but welcome to communicate.
If you feel a little bit interesting, welcome to Goku's little garage.
Talk about the complement 1.