next up previous
Next: Biased Representation Up: Integers Previous: One's Complement

Two's Complement

Two's complement representation has a single zero representation and eliminates the end-around carry operation required in one's complement addition.

Positive two's complement integers have the same representation as unsigned numbers.

The additive inverse in two's complement is formed by taking the one's complement of a number and then adding 1 to the least significant bit.

Comparing this procedure to one's complement, it is easy to see that the value of an (n+1) bit two's complement integer is:

displaymath322

The range of values for an (n+1) bit two's complement integer is tex2html_wrap_inline324 to tex2html_wrap_inline310 .

Since the additive inverse of 0 is 0 in two's complement, the zero value has a unique representation.

To find the 8 bit two's complement representation of -8:

tabular106

Examples of 8-bit two's complement numbers:

tabular113

The range of 8-bit two's complement integers is -128 to +127.

Addition of signed numbers in two's complement is performed using simple binary addition.

To add decimal 17 to decimal -8 in 8-bit two's complement:

tabular126

A carry out of the most significant bit is ignored in two's complement addition.



CS 301 Class Account
Mon Sep 14 23:38:35 ADT 1998