Reputation: 459
How do I convert a binary to fraction such as for example .10101010001? I am trying to convert a binary fraction to decimal fraction.
Upvotes: 0
Views: 2889
Reputation: 6178
It would be the same way that you would do it for a decimal number.
0.48 in decimal is the same as:
4 * 10^-1 + 8 * 10^-2
So for binary, if you had something like 0.101 it would be:
1 * 2^-1 + 0 * 2^-2 + 1 * 2^-3
and so on...
EDIT (as per request):
If you would want to obtain a fraction of the number, you could do the following:
Let n be the number of digits (e.g. 0.1011 => n=4)
Convert the number as if it did not have a binary point let this be m (0.1011 => m=11).
Your result is
m / 2^n
Upvotes: 3