sign-magnitude representation

  • consists of 2 parts: sign and magnitude
  • decimal example: and
  • binary example:
    • sign represented by MSB (most significant bit = leftmost digit): 1 = negative, 0 = positive

two’s complement representation

  • positive numbers represented as usual
  • leading 1’s for negative numbers
  • to negate any number
    • flip all the bits
    • add 1 to the least significant bit (LSB = rightmost digit)