Page 30 - computer science (868) class 11
P. 30
2. Find the 2’s complement of the subtrahend by adding 1 to its 1’s complement.
3. Add this answer to the minuend.
4. Exclude leftmost carry (MSB) to get the answer.
Example 1: (1110101) - (11001) (using 2’s complement method).
2
2
Answer: 1110101 has 7 bits and 11001 has 5 bits.
+1 +1 +1 +1 +1
Adding prefix 0, we get 0011001 1 1 1 0 1 0 1
1’s complement of 0011001 is 1100110 + 1 1 0 0 1 1 1
2’s complement is 1100110 + 1 = 1100111 1 1 0 1 1 1 0 0
Adding 1110101 and 1100111, we get Discarding MSB 1, we get 1011100
(1011100) 2
Example 2: (1001.01) - (111.1) (using 2’s complement method).
2 2
Answer: 1001 has 4 bits and .01 has 2 bits, whereas, 111 has 3 bits and .1 has 1 +1
bit. So, adding 0’s, we get 0111.10 1 0 0 1 . 0 1
1’s complement of 0111.10 is 1000.01 + 1 0 0 0 . 1 0
1 0 0 0 1 . 1 1
2’s complement = 1000.10 Discarding MSB 1, we get 1.11
Adding 1001.01 and 1000.10, we get
(1.11)
2
Case 2: When minuend is smaller than subtrahend
The steps to be followed are:
1. Make the number of digits of the subtrahend equal to minuend by adding trailing 0’s in the fractional part of the
subtrahend if required.
2. Find the 2’s complement of the subtrahend by adding 1 to its 1’s complement.
3. Add this answer to the minuend.
4. Find 2’s complement of the sum and add 1 as the sign bit in MSB or the -ve sign as answer.
Example 1: (10110) - (1100010) using 2’s complement method. +1 +1 +1 +1
2 2
Answer: 1’s complement of 1100010 is 0011101 1 0 1 1 0
+ 0 0 1 1 1 1 0
2’s complement = 0011110
0 1 1 0 1 0 0
Adding 10110 and 0011110, we get 1’s complement of 0110100 is 1001011
(-1001100) 2’s complement of 1001011 is 1001100
2
Example 2: (111.1) - (11000.10) (using 2’s complement method). +1 +1 +1 +1
2
2
Answer: 1’s complement of 11000.10 is 00111.01. 1 1 1 . 1
+ 0 0 1 1 1 . 1 0
2’s complement = 00111.10
0 1 1 1 1 . 0 0
Adding 111.1 and 00111.10, we get 1’s complement of 01111.00 is 10000.11
(-10001.00) 2 2’s complement of 10000.11 is 10001.00
1.3.3 Binary Multiplication
Binary numbers are multiplied in the same manner as decimal numbers. When two binary numbers are multiplied, for
each digit of the second number, the product of that digit of the first binary number is calculated. Then it is shifted
2828 Touchpad Computer Science-XI

