Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there architectures which are not using two's complement for representation of negative values?

The benefits of using the two's complement for storing negative values in memory are well-known and well-discussed in this board.

Hence, I'm wondering:

Do or did some architectures exist, which have chosen a different way for representing negative values in memory than using two's complement? If so: What were the reasons?

like image 709
Multisync Avatar asked Sep 08 '14 20:09

Multisync


1 Answers

Signed-magnitude existed as the most obvious, naive implementation of signed numbers.

One's complement has also been used on real machines.

On both of those representations, there's a benefit that the positive and negative ranges span equal intervals. A downside is that they both contain a negative zero representation that doesn't naturally occur in the sort of integer arithmetic commonly used in computation. And of course, the hardware for two's complement turns out to be much simpler to build

Note that the above applies to integers. Common IEEE-style floating point representations are effectively sign-magnitude, with some more details layered into the magnitude representation.

like image 177
Phil Miller Avatar answered Oct 14 '22 12:10

Phil Miller