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

Binary adding/subtracting, am i doing this right?

  1. Nov 27, 2005 #1
    Hello everyone, i'm alittle confused, we have an exam tomarrow and i want to make sure i'm doing this right. I'm suppose to do the following:
    Perform the indicated subtraction with the following unsigned binary numbers by taking the 2's compliment of the subtrahend.
    so for one of them:
    10110 - 1111
    I take the 2's compliment of 1111 which is:
    1's compliment: 0000
    2's compliment: 0000 + 1 = 0001
    now i add 0001 to 10110

    now since i'm only adding a 4 bit number to a 5 bit number my final answer will only still be in 4 bits right? so it would be
    0111 as the final answer right?
    I used a binary calculator and it said the answer is 111, but i think it just wasn't programmed to included the 0 infront.
  2. jcsd
  3. Nov 27, 2005 #2
    Also what would
    101 - 101000 equal? the calculaotr came out with a huge number:

    when i take the 2's compliment of 101000 and add it to 101 i get: 011101
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook