Binary Number System: Representations

BINARY ADDITION OF 2'S-COMPLEMENT NUMBERS


Binary addition of a 2's-complement signed integer is very simple. The rules are the same as decimal addition, except that the carry of 1 happens when 1 is added to 1. That is:

0 + 0 = 0
1 + 0 = 1
0 + 1 = 1
1 + 1 = 0, carry the 1
A carry from the most significant bit position is discarded. The carry out from the most significant bit must be the same as the carry in to that bit (either both 0 or both 1), otherwise an overflow or underflow error has occurred.

For example, using 4-bit 2's-complement signed binary integers:
  0 0 1 1  note: 00112 = 310
+ 0 0 1 1  =  3
---------
  0 1 1 0  =  6; carry in = carry out of sign bit = 0

  1 0 0 1  = -7
+ 0 0 1 1  =  3
---------
  1 1 0 0  = -4; carry in = carry out = 0

  1 0 0 1  = -7
+ 1 0 0 1  = -7
---------
  0 0 1 0  = ERROR; 1 = carry out bit; 0 = carry in to sign bit

  0 1 1 1  =  7
+ 0 1 1 1  =  7
---------
  1 1 1 0  = ERROR, 0 = carry out; 1 = carry in

  1 1 0 1  = -3
+ 1 1 0 1  = -3
---------
  1 0 1 0  = -6; carry out = carry in = 1; carry out bit is discarded.

  1 1 0 1  = -3
+ 0 0 1 1  =  3
---------
  0 0 0 0  = 0; carry out = carry in = 1; carry out bit is discarded.

Homework

Next Page