1's COMPLEMENT
1's COMPLEMENT
Suppose we have a binary number x having an integer part of n
digits. Then ( b- 1) complement of the number x can be calculated by
taking the difference between the base raised to the nth power minus
1 and the number x.
So, the (b - 1) 's complement
of number x = (bn - 1) - x.
In case of binary numbers, b = 2. Therefore, 1's complement of a binary number
x can be calculated as ( 2n - 1) - x.
It is also known as radix - minus - one
complement.
EXAMPLE : Find the l's complement of (10001)2.
SOLUTION: Number, x = 10001
Number of digits in number, n = 5
Also, decimal equivalent of (10001) 2 = 17
So, substituting these values in the
formula x = (bn - 1) -
x, we get
l's complement of (10001)2
= (25 - 1) - 17
= (32 - 1) - 17
= 31 – 17
= 1410
= 11102
The result 1110, can also be written as (01110).
From the above example, we notice that the l's complement of the
given binary number can be calculated by simply changing l's to 0's and 0's to
l's . Therefore,
·
l's
complement of (010110)2, is (101001)2
·
l's
complement of (101110)2 is (010001)2
·
1's
complement of (101.101)2, is (010.010)2
In case of a number with fractional part, the l's complement is obtained
by using the formula 2n
– 2-m - x, where m is the number of digits in the fractional
part and n is the number of digits in the integer part.
For example: The l's complement of
(0.0110)2 is
= (20 – 2-4)2 - (0.110)2
= (0.1111)2 – (0.0110)2
= (0.0110)2
SUBTRACTION USING 1’S
COMPLEMENT METHOD:
The method of subtraction
of two positive binary numbers (M - N) using 1's complement method is similar
to the method of subtraction using 2's complement method except for one
variation called “end around carry". The rules for subtraction using
l's complement method are as follows,
1. Add the minuend M to the l's complement of
the subtrahend N.
2. Examine the result obtained in step 1,
A. If an end carry is produced then add 1 to the least
significant digit (end - around carry).
B. If
no end carry occurs, take the l's complement of the result obtained in step 1
and place negative sign in front.
EXAMPLE :
1. Subtract (01101)2, from (11101)2,
using 1's complement method.
SOLUTION: Here, M = (11101)2, and N =
(01101)2
l's complement of (01101)2
= (10010)2
On adding it to the minuend M, we get
1 1 1 0 1 + 1 0 0 1 0 = 1
0 1 1 1 1
As end carry is produced, so as per rule 2(a) we add 1 to the
least significant digit, we get
0 1 1 1 1 + 1 = 1 0 0 0 0
Therefore, (11101)2 – (01101)2 = (10000)2
2. Subtract (111010)2 from (101001)2 using 1’s
complement method.
SOLUTION: Here, M
= (101001)2 and N = (111010)2
On adding it to minuend M, we get
1 0 1 0 0 1 + 0 0 0 1 0 1 = 1 0 1 1 1 0
As no end carry is produced, so as per rule 2(b) we take 1’s
complement of (101110)2 which turns around to be (010001)2
and place a negative sign in the front,
Therefore, (101001)2 – (111010)2 = -(010001)2
Leave a Comment