Binary Arithmetic

Binary Addition and Subtraction

Addition is straightforward.

Subtraction is just adding the negation of the second operand.

Eight bit two's complement binary numbers:

  00001111two = 15ten
- 00000101two =  5ten
  --------

  ========

This is equivalent to

   00001111two = 15ten
 + 11111011two = -5ten
   --------
(1)00001010two = 10ten
   ========

The carry out from the leftmost bit is discarded.

Detect overflow by checking the sign of the operands and the result.

When can overflow occur with addition?

What about with subtraction?


CSE 378 Spring 2002 - Section 1
First Previous Page 4 Next Last