Tag Archives: 2s Complement

2’s Complement

Right I am adding the finishing touches to the revision powerpoint I promised you. However, while I was going over sign and magnitude, I came across this.

http://en.wikipedia.org/wiki/Signed_number_representations

“Useful” I hear you say, but there is more to this than meets the eye. There is on that page a method for converting a number to 2’s complement that I haven’t see in quite a while and I thought I might share it with you.

  1. Starting from the right, find the first ‘1’
  2. Invert all of the bits to the left of that one
So for 42 to convert it to -42
  1. 00101010
  2. 11010110