Skip to main content

Two's Complement Overflow

Unlike unsigned numbers, a carry out of the most significant column does not indicate overflow.

When adding N-bit numbers, the carry out the Nth bit (i.e. the N + 1th bit) is discarded.

Example: Compute 11012 + 10012

   1101 = (-8+4+1) = -3
+ 1011 = (-8+2+1) = -5
====
1 1000 = -8 (no overflow)

There is no overflow when adding numbers with different sing.

If, after adding two numbers with same sign, you get a result with other sign - this is overflow.

Example: Compute 410+510 using two's complement numbers.

4-bit Overflow
  0100 = 4
+
0101 = 5
----
1001 = -7 -> Overflow

In this case sign extension will help.

Overflow can be very dangerous. Crash due to overflow.

From: Harris D. M., Harris S. L. - Digital Design and Computer Architecture, 2nd Edition - 2012
1.4.6 Signed Binary Numbers - 18 page

Resources