• Advertisement
Sign in to follow this  

why twos complement?

This topic is 4309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why do most hardware like Intel processors use two's complement integers, so that -8 is translated to 1111 1000? What possible benefit could such an implementation have? Why not just set the most significant bit??? Thanks for any responses!

Share this post


Link to post
Share on other sites
Advertisement
It significantly simplifies the addition hardware. Also, if you use a sign bit, you have two possible zeros: +0 and -0 (as floats do).

Share this post


Link to post
Share on other sites
Because two's compliment allows addition and subtraction to be performed with the same hardware, processors designed this way are simpler and more economical.

for example:

(base 10)
10
+(-08)
______
02

(base 2)
00001010
+11111000
_________
100000010

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement