For example in the decimal (base 10) system the complement of 7 is 3 (i.e 7 + 3 = 10)
the complement of 8 is 2
etc.
the complement of 99 is 01 (i.e 99 + 1 = 100)
the complement of 78 is 22 (not 32)
the complement of 2000 is 8000
etc. It is a curious fact that a computer subtracts using addition.
First a method known as 2's Complement is used to create a negative representation of the number to be subtracted..
Then subtraction is a matter of adding the negative number to the number from which it is being subtracted. (!)
But before we look at 2's complement, let's use a familiar number system to understand the concept of complements. Complements The complement of a number is the number which when added to the original will make it equal to a multiple of the base number system.
The complement of a number can be used as a representation of that number as a negative - moreover, as a positive number representing a negative! It is really a bit of a trick which we can use to make subtraction easier for machines.
For example in the decimal (base 10) system the complement of 7 is 3 (i.e 7 + 3 = 10)
the complement of 8 is 2
etc.
the complement of 99 is 01 (i.e 99 + 1 = 100)
the complement of 78 is 22 (not 32)
the complement of 2000 is 8000
etc.
Consider that: -1 = +9 -10 -99 =
+1 -100 -7 = +3 -10 -78 =
+22 -100 -56 = +44 -100 -200 = +800 -1000
If we can 'lose' the multiple of 10 which has been used to create the complement, then we can subtract using addition - based on the principle that :
subtraction is mathematically the same as adding the negative of the number we want to take away.
The complement method of subtraction uses the complement as a negative representation of the number to be subtracted.
For example in the decimal (base 10) system:
7 minus 3 is mathematically the same as 7 plus (minus 3)
i.e: 7 - 3 = 4 is the same as 7 + (-3) = 4
3 minus 3 is mathematically the same as 3 plus (minus 3)
i.e: 3 - 3 = 0 is the same as 3 + (-3) = 0
the complement of 3 is 7
7 minus 3 is the same as 7 plus the complement of 3
so: 7 - 3 becomes 7 + 7 which =14
If we remove the left-most 'additional' digit, 7 - 3 = 4 is the same as 7 + 7 = (1)4
We discard additional left-most digits.
We can see them as being additional because conceptually a new left-most column is added.
In the above example '7 minus 3' is a single column subtraction and the answer will only require a single column.
Consider that if we are using a machine with cogs, or a computer with a fixed number of bits, it is easy to 'lose' the leftmost digit. In the following examples, all the results when we use a complement for subtraction have an additional 1 in the leftmost column - which we discard when looking at the answer. Note however that the '1's also flag the result is a positive number.
1)
7
-7
0 1a)
7
+3
1 0 !
!
! 2)
99
-78
21 2a)
99
+22
1 21 !
!
! 3)
2000
-1999
0001 3a)
2000
+8001
1 0001 !
!
! 4)
100
- 7
93 4a)
100
+ 3
103 !
!
! 5)
100
-007
093 5a)
100
+993
1 093 In example 4a, the answer is incorrect! but as soon as we realise that in this system: the number we are subtracting must have the same number of digits as the number from which we are subtracting, then we can obtain a correct result. Study the examples 5) and 5a) above. Can you see why the complement of 007 is 993? In the following examples, note that there is no 'discard' column - I have put a '0' to denote this.
Can you see why the answers appear incorrect? and what needs to be done?
6)
1
-2
-1 6a)
1
+8
0 9 !
!
! 7)
7
-17
-10 7a)
07
+83
0 90 !
!
! 8)
11
-78
-67 8a)
11
+22
0 33 !
!
! 9)
2000
-2999
- 999 9a)
2000
+7001
0 9001 All the results in the sums above should be negative. The results in the sums using complements are negative but are still shown as complements (i.e as positive representations of negative numbers). If we were using a machine to do these calculations we could set it to note that there is no discarded leftmost digit and that in order to return a 'true' negative number, the result needs to be replaced by its complement with a minus sign in front.
So, in the examples above, '9' is the complement form of '-1', '33' = '-67', etc.
Copyright: Tony Drewry
The complement involves probability. Say the probability of choosing a red marble was 3/10. So the complement, or the chance of not choosing a red marble is 7/10. Think of it as the opposite of the probabilty. You simply subtract the numerator from the denominator and you have the complement. (10-3=7 in this case, then you would put your difference over the probabilities denominator, so it would be 7/10.)
7.
magenta!
The probability of something NOT happening is the complement of the probability of something happening. Since the probability that you DO have 3 heads is 1/8 (that is, 1/2 cubed), the complement is 1 - 1/8 = 7/8.
A self complementing code is one thats 9's complement in decimal is the 1's complement in binary.Ex: The 9's complement of 7 is 2 in decimal. In 2421 code, and .
Excess-3
It is pi/6.
As a verb: enhance As a noun: adjunct
25
321
Using 4 bits the signed range of numbers is -8 to 7. When working with signed numbers one bit is the sign bit, thus with 4 bits this leaves 3 bits for the value. With 3 bits there are 8 possible values, which when using 2s complement have ranges: for non-negative numbers these are 0 to 7; for negative numbers these are -1 to -8. Thus the range for signed 4 bit numbers is -8 to 7.
1 18 9 3 2