Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Why is 1000 = -8 in signed 4-bit binary?

  1. Jan 13, 2010 #1
    I was wondering why 1000 in signed 4-bit binary notation is equal to -8 in decimal. From my understanding, the 1 simply states that sign (1 being negative and 0 being positive) it has no real decimal value. I have read that it is not possible to correctly take the 2's complement of -8 so I cannot come to convince myself that 1000 is in fact -8 in binary.

    Thanks for the help!
     
  2. jcsd
  3. Jan 13, 2010 #2

    Hurkyl

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Try adding 4 to it. Then add 4 again.
     
  4. Jan 13, 2010 #3
    The left-hand bit is indeed the sign bit, but "-0" doesn't really make sense. Plus, if we allowed -0 and +0, we'd have 2 binary values for zero.

    The positive values are easy:
    0 = 0000
    1 = 0001
    2 = 0010
    3 = 0011
    4 = 0100
    5 = 0101
    6 = 0110
    7 = 0111

    For the negative values, you need the 2's complement (invert all the bits, then add "1")

    -1 = 1110 + 1 = 1111
    -2 = 1101 + 1 = 1110
    -3 = 1100 + 1 = 1101
    -4 = 1011 + 1 = 1100
    -5 = 1010 + 1 = 1011
    -6 = 1001 + 1 = 1010
    -7 = 1000 + 1 = 1001

    The only combination not yet used in either positive or negative values is "1000"
    This could equal either 8 or -8, so in keeping with the sign bit convention, -8 is used.

    So, signed 4-bit binary gives you the values -8 to 7.
    Similarly, signed 8-bit binary give you -128 to 127 and signed 16-bit binary give -32768 to 32767.
     
  5. Jan 15, 2010 #4
    alright i understand now thanks for the explanation!
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook