Binary representation of signed integers

  1. One simple idea is sign-magnitude representation.
    • Given n bits, use the most significant (leftmost) bit for the sign("1" means negative), and the remaining n-1 bits to represent the magnitude.
    • Examples (assuming 8 bits):
              33 is represented by 0010 0001
             -33 is represented by 1010 0001
    • Remarks
      • with 16 bits, -33 is represented by
        1000 0000 0010 0001
      • Given n bits, there are
           2n-1 - 1 possible positive number representations
           2n-1 - 1 possible negative number representations
        and 2 zero representations (!)

        1010 = -2
        1001 = -1
        1000 = -0
        0000 = +0
        0001 = +1
        0010 = +2

  2. ALTERNATIVELY a favored representation is 2's Complement representation that makes subtraction somewhat easier. We will look at this system later.
[Prev][TOC][Next]

CS1104 Main Page
Last Updated 01/05/2000
© L.Heath, 2000