wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

What is two's complement?

As we noted in the previous tutorial, two's complement is a procedure we can apply to eliminate negative zeros.

The concept is actually very simple. If we know we can have a negative zero, then to make it a simple zero, all we have to do is add '1'.

For example, we saw that when we added +56 and -56, we got the result:

Which turned out to the value -0 (Negative zero). Suppose, however, that after we complemented +56 (to get -56), we added '1':

How is this helpful ???

Let's add our 'old' +56 with our 'new' -56:

So, two's complement is the silver bullet ???

Actually, it is no better than one's complement. It has it's advantages and disadvantages. It is, however, the most commonly used approach.

Which is better: One's or two's complement ??

That is our next topic.

Some good references to help you better understand two's complement include:

Binary Subtraction by Complementary Addition
T
wo's complement from Free on-line Dictionary of Computing
Twos complement - Computing Reference - eLook.org

Some questions you should be able to answer:

  1. Twos complement requires

    a.  adding 2 to the number
    b.  adding 1 to the ones complemented number
    c.  adding 2 to the ones complemented number
    d.  adding1 from the uncomplemented number
    e.  adding 2 to the uncomplemented number

    answer: b
     

  2. How would you store the value -176 as a short integer using twos complement?
     

This page was last updated on 05/30/05.