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

Homework Help: Binary help!

  1. Sep 8, 2008 #1
    The problem statement, all variables and given/known data
    Calculate the binary equivalent of 2/3 out to eight places. Then convert from binary to decimal. How close is the result to 2/3?


    The attempt at a solution

    I new to this and I am still trying to figure this stuff out so if someone could walk me through this that would be great! Here's what I came up with from some stuff I read.....

    2/3 * 2 = 1+1/3 X1=1
    1/3 * 2 = 0+2/3 X2=0
    .......and so on.....

    I did that out to 8 places and got the number 10101010 and i suppose that that is actually 0.10101010 since 2/3 is .66666667?

    Is this correct and if so how do I convert to decimal?
     
  2. jcsd
  3. Sep 8, 2008 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Fractions in binary are stored as sum's of negative powers of two.
    So write the headings, 1/2 1/4 1/8 1/16 1/32 ......
    Convert the decimal to binary in almost the same way as you would for a whole number.
    eg 0.66666666 -0.5 = 0.16 , so a 1 in the half column
    0.16 is less than 0.25 so a 0 in the quarter column
    0.16 - 0.125 = 0.035 so a 1 in the 1/8 column

    etc.


    If you do it this way, you have the remainder automatically as you work out thebinary.
     
  4. Sep 8, 2008 #3
    I don't understand why your subtracting?
     
  5. Sep 8, 2008 #4

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Each time you put down a 1 (representing a value of 1/2 or 1/4 of 1/8, etc.), you have less and less remainder left.

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