JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (oldest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
Re: Why two's complement (response to post by FalconsGaze) | Reply
Also note that two's complement is just Z mod some power of 2.
Re: Why two's complement (response to post by FalconsGaze) | Reply
The biggest reason is that if you're working in two's complement, you can add negative numbers without having to code any annoying logic. Say we were working on a 4-bit processor :)

In two's complement, 3 = 0011 and -1 = 1111. Added together and discarding the high bit, we have 0010 = 2, which is the right answer. In one's complement, we'd have 0011 and 1001. To get the right answer here, we'd have to special case the high (sign) bit, and then also call the subtraction routine instead. This is a lot of hassle, and is also slower when you get down to the logic gate level.
Why two's complement | Reply
Is it to avoid positive and negative zero?
RSS