Jump to content

how to convert fractional decimal to binary ?


raja.mugavai

Recommended Posts

I'm not sure if you want binary fractions, or a binary number with a 'decimal' point.

If you want a binary fraction, then just change the numerator and denominator into binary. Since 1(dec)=1(bin) and 2(dec)=10(bin):
1/2(dec) = 1/10(bin)

Similarily 1/4(dec)=1/100(bin).

If you want to find the equivalent binary number with a 'decimal' point, then there are two ways to do it:

First way using the number 3/4=0.75 as an example.
1 ) Multiply the dec# by a power of two so that it is integral: ex. 0.75*2^2=3
2 ) Convert this integral number into binary: ex. 3(dec)=11(bin)

3 ) Now divide this new binary number by the same power of 2, you multiplied the decimal one by. Since you are in binary, dividing by a power of two is just moving the 'decimal' point: ex 11(bin) / 2^2(dec) = 0.11 (moving the decimal twice to the left).
You have your answer. 3/4=0.75(dec)= 0.11(bin)

Second way using the same example

1 ) Multiply decimal fraction by 2: ex. 0.75*2= 1.5
2 ) Take the number in the unit place (one's place): ex. in this case it would be a 1, this is the first digit after the decimal point for the binary equivalent. ie. 0.75(dec)=0.1????(bin)

3 ) Take the fraction part of the new decimal number and multiply by two again: ex. 0.5*2= 1.0
4 ) Again take the number in the units place as the next binary number: so 0.75(dec)=0.11???(bin)

5 ) Keep repeating this until you get a 0 as the fraction part of the decimal number, or until the decimal part starts repeating: in this case we got a 0 in the fractions part of the decimal number 1.0, so we stop.

If the fraction part starts repeating you know that the binary fraction repeats too.

Edited by tarimshahab
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.