CIS3355:
Business Data Structures |
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:
Some questions you should be able to answer:
|