assemblybinaryinteltwos-complement

Excess-N to 2's complement


Could someone please explain how to do this? It's not homework.

Could someone please explain to me how to do this?

Show that if N is chosen to be equal to 2^(m-1) where m is the number of bits
in the representation, then an Excess N representation will be the same as a 2's
Complement representation but with the sign bit inverted. Hint - transform the
summation formula for Excess-N numbers to the summation formula for 2's Comp
numbers.

First of all, how do I transform the summation formula for excess-N numbers to the formula for 2's Complement numbers? Secondly, how exactly am I supposed to prove that?


Solution

  • Numbers in a computer are stored as m bits which hold a number in the range [0..(2^m)-1] -- positive (unsigned) numbers. So to represent negative numbers, you need to encode the negative numbers into this space somehow. There are number of ways of doing that, and the terms Sign-Magnitude, Twos-complement, Ones-Complement and Excess-N all refer to different way of doing that.

    Excess N notation means that you deal with negative numbers by adding the constant N to all numbers, so that you only ever have positive numbers to deal with. So a value of 0 represents -N, a value of 1, represents -N+1, etc. A value of N represents 0.

    Now, I'm not sure what book you are referring to, but a Summation Formula will usually refer to a way of computing a value by summing a bunch of terms. In the context of numeric representations, it usually assigns a 'value' to each bit, such that the sum of the value for the set bits gives you the number that is encoded. When you do this for Twos-complement, you end up with one formula, and when you do it for Excess-N you end up with a slightly different formula, but you should be able to see/show the equivalence in your quoted question.