Complements are used in digital computers for simplifying the subtraction operation and for logical manipulation. There are two types of complements for each base r system: the r's complement and the (r - l)'s complement.When the value of the base r is substituted in the name, the two types are referred to as the 2's and I's complement for binary numbers and the ID's and 9's complement for decimal numbers.
(r - l )'s Complement :
9' s complement:
Given a number N in base r having n digits, the (r - I)'s complement of N is defined as (r' - I) - N. For decimal numbers r = ID and r - I = 9, so the 9's complement of N is (ID' - I) - N. Now, ID' represents a number that consists of a single I followed by n D's. 10' - I is a number represented by n 9's. For example, with n = 4 we have ID4 = 10DDD and ID4 - I = 9999. It follows that the 9' s complement of a decimal r:tumber is obtained by subtracting each digit from 9. For example, the 9's complement of 5467DD is 999999 - 5467DD = 453299 and the 9's complement of I2389 is 99999 - 12389 = 876ID.
|These Topics Are Also In Your Syllabus|
|You May Find Something Very Interesting Here.||link|
|3||Common Bus System||link|
|4||Common Bus System-memory address||link|
For binary numbers, r = 2 and r - I = I, so the I's complement of N is (2' - I) - N. Again, 2' is represented by a binary number that consists of a I followed by n 0's. 2' - I is a binary number represented by n I's. For example, with n = 4, we have 24 = (10000), and 24 - I = (1111),. Thus the I's complement of a binary number is obtained by subtracting each digit from I. However, the subtraction of a binary digit from I causes the bit to change from 0 to I or from I to 0. Therefore, the I's complement of a binary number is formed by changing I's into 0's and 0's into I's. For example, the I's complement of I011001 is 0100110 and the I' s complement of 0001 111 is 1 1 I0000.
The (r - I)'s complement of octal or hexadecimal numbers are obtained by subtracting each digit from 7 or F (decimal i5) respectively.