Page 31 - ComputerScience_Class_11
P. 31
Two cases may arise:
Case 1: When minuend is greater than subtrahend
The steps to be followed are:
1. Make the number of digits of subtrahend equal to minuend by adding leading 0s in the integer part and trailing 0s
in the decimal part if required.
2. Find the 1’s complement of the subtrahend by changing 0 with 1 and 1 with 0.
3. Add this result to the minuend.
4. Add the leftmost carry (MSB) with the rightmost digit (LSB) to get the final result.
Diminished Radix Complement
n
Given a number N in base r having n digits, the (r - 1)’s complement of N is defined as (r - 1) - N. For decimal numbers, r = 10
and r - 1 = 9, so the ninth complement of N is (10 - 1) - N. Now, 10 represents a number that consists of a single 1 followed by
n
n
n 0s. 10 - 1 is a number represented by n 9’s.
n
Example 1: (1110101) - (11001) (using 1’s complement method). +1 +1 +1
2
2
Answer: Minuend 1110101 has 7 bits and subtrahend 11001 has 5 bits. 1 1 1 0 1 0 1
Adding preceding 0s, we get 0011001 + 1 1 0 0 1 1 0
1’s complement of 0011001 is 1100110 1 1 0 1 1 0 1 1
Adding 1110101 and 1100110, we get 11011011 1
(1011100) 2 1 0 1 1 1 0 0
Example 2: (1001.01) - (111.1) (using 1’s complement method). +1 +1
2
2
Answer: Integer part of 1001.01 has 4 bits and fractional part 2 bits 1 0 0 1 . 0 1
Prefix 0 is added to 111 and suffix 0 is added to fractional .1 to get 0111.10 + 1 0 0 0 . 0 1
1’s complement of 0111.10 is 1000.01 1 0 0 0 1 . 1 0
Adding 1001.01 and 1000.01, we get 10001.10 1
(1.11) 2 1 . 1 1
Case 2: When minuend is smaller than subtrahend
The steps to be followed are:
1. Make the number of digits in the fractional part of subtrahend equal to minuend by adding trailing 0s if required.
2. Find the 1’s complement of the subtrahend.
3. Add this answer to the minuend.
4. Find 1’s complement of sum and write 1 as sign bit in MSB or -ve sign as the answer.
Example 1: (10110) - (1100010) (using 1’s complement method).
2
2
Answer: 1’s complement of 1100010 is 0011101 +1 +1 +1
1 0 1 1 0
Adding 10110 and 0011101, we get 0110011
+ 0 0 1 1 1 0 1
1’s complement of (0110011) : 0 1 1 0 0 1 1
2
(-1001100) 2 1’s complement of 0110011 is 1001100
Example 2: (111.1) - (1001.01) (using 1’s complement method). +1 +1 +1 +1
2
2
Answer: 1’s complement of 1001.01 is 0110.10 1 1 1 . 1 0
Adding 111.10 and 0110.10, we get 1110.00 + 0 1 1 0 . 1 0
1’s complement of (1110.00) : 1 1 1 0 . 0 0
2
(-1.11) 2 1’s complement of 1110.00 is 0001.11
System of Numeration 29

