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

Simple binary subtraction

  1. Feb 15, 2010 #1
    Hi Friends,

    I'm scratching my head for not able to figure out this problem of binary (fraction) subraction.


    0.1101 - 0.00000011 = 0.11001101

    Can someone plz help me with steps how do i get the answer as sshown above .

    I tried as shown below and im getting a different answer. Am i doing something terribly wrong.

    0.11010000
    - 0.00000011
    ---------------
    0.10000011 ----> this answer is wrong

    Thanks,
    Nesta
     
  2. jcsd
  3. Feb 15, 2010 #2
    Is this class homework?

    KM
     
  4. Feb 15, 2010 #3
    NO it is not.. if its a class homework how will know its answer..
     
  5. Feb 15, 2010 #4
    It's quite simple, and is done in exactly the same way as with decimal numbers. You have:

    0.11010000
    -0.00000011
    _____________
    0.11001101

    1) Rightmost column: 1>0, so you must borrow "10" from the next column, and then 10-1=1
    2) Next Column: This column had "0" in it, so you borrow "10" from the next, but you have already borrowed "1" from this column, so that leaves 1 in the numerator, and 1 - 1 = 0
    3) Next column, same as previous, and you get 1 - 0 = 1
    4) and so fourth

    Actually the easier way is to complement the subtrahend and add it to the minuend. In this you have:

    000.11010000
    111.11111100
    (1)000.11001100

    Then, you add the "1" that overflows at the left back in the rightmost column, and get:

    000.11001101

    KM

    B.T.W. Would anyone like to see how complement subtraction works in the decimal system?
     
  6. Feb 28, 2010 #5
    *tentatively raises hand*
     
  7. Mar 1, 2010 #6
    I'm scared of subtraction! ::Hides::
     
  8. Mar 6, 2010 #7
    Nobody expressed interest, but here's how to do complement subtraction in decimal. First, we use the following to get the 'inversion' of each digit (subtrahend only):

    0 -> 9
    1 -> 8
    2 -> 7
    3 -> 6
    4 -> 5
    5 -> 4
    6 -> 3
    7 -> 2
    8 -> 1
    9 -> 0
    Now, for each digit in the 'subtrahend', substitute its inversion from the list above (remember. leading zeros all go to nine). Then add "1" to the inverted subtrahend value, to get the complement. Then simply add. Any "1" that carries out beyond the end is dropped (or it can be described as being used in an "end-around-carry" in place of the one that was previously added). Try it!

    KM
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook