Two's Compliment method of Subtraction for Binary Numbers:

  1. Take the two's compliment of the negative number. (How to form the twos compliment.)  If necessary add leading zeros to the MSB of the negative number so that it is the same number of bits as the positive number.
  2.  Add the two's compliment just found to the positive number using binary addition.
  3. a) If there is a carry out of the MSB:
       Discard the carry.  The result is the answer in binary.
    b) If there is no carry out of the MSB:
    The answer is negative and the value of the answer in two's compliment form.  Convert the answer by taking its two's compliment and indicate that it is negative.
Examples
 Problem Take 2's compl. of negative number
add it to the other number
(a) Drop the carry bit, or...
(b) Convert from 2's compliment form
Decimal equivalent of problem
 11010
-10111
-10111=>>01000+1
  =01001
  11010
+ 01001
=100011
00011

  26
 -23
= +3
  1011
-10010
-10010=>>01101+1
  =01110
 01011
+01110
=11001
(no carry)
11001=>00110+1
=00111 (negative)
  11
 -18
= -7
 11000101
- 1111011
(note leading zero added)
-01111011=>>10000100+1
  =10000101
  11000101
+ 10000101
=101001010
01001010

 197
-123
= 74
 11000101
-11101010
11101010=>>00010101+1
   =00010110
  11000101
+ 00010110
= 11011011
(no carry) 11011011=>00100100+1
 =00100101
(negative)
  197
 -234
= -37

Note: How to form the two's compliment of a binary number:

  1. Compliment (take the opposite value) of each bit in the number.
  2. Use binary addition to add one to this new number.
  3. To get any number OUT of two's compliment form, just two's compliment it again.
Examples
 Number Take compliment of each bit
add one
  2's compliment
 11010
11010=>>00101
  00101
+     1
= 00110
 00110
  111111
111111=>>000000
 000000
+     1
=000001
  00001
 100000
100000=>>011111
  011111
+      1
= 100000
  100000
 00110 00110=>>11001
  11001
+     1
= 11010
  11010
top of pageto Prof Wade's General Webinfo Page
Valid HTML 4.01!updated 2/8/05 Corrections, additions, notice of broken links, etc. are most welcome. Please E-mail: Prof. Donald Wade <WadeD@ncc.edu>
Document made with Nvu