0360. What is one’s compliment? What
is two’s compliment? Which do we use and why??
One’s compliment is straight-forward complimenting
(see previous question). However, problems can occur. We can end-up with a -0
(negative zero). To counteract the problem, iff the result of adding a negative
number is non-negative, we must add ‘1’ to the result.
In two’s compliment, we perform a one’s
compliment and then add one to the result.
Most
machines use two’s compliment
because in one’s compliment we can add numbers together and end-up with a -0
(negative zero), whereas in two’s compliment, we can not.