Just as an integer in base b is represented in terms of powers of b,
a fraction N in base b is represented in terms of the negative powers of b:
N = c1b-1 + c2b-2 + c3b-3 + + cnb-n + ........ Equation (1)
where 0 ≤ ci < b. This is what is meant when we write N as 0.c1c2c3c4
So, converting a fraction given in any base to a corresponding fraction in base 10 is easy:
0.0112 = 0 × 2-1 + 1 × 2-2 + 1 × 2-3 = 0 + 1/4 + 1/8 = 0 + 0.25 + 0.125 = 0.37510.
This is often called the expansion method.
There is another way also to do this. That is to write the binary fraction as a ratio. For instance 0.0112 = (11/1000)2 = 112/10002 = (3/8)10 = 0.37510. The opposite way, that is converting a decimal fraction in to a binary fraction, requires more steps. It is called the Multiplication Method.
How do we convert 0.37510 to base 2 or any other base?
To convert, we need to pick up the coefficients c1, c2, c3,
Consider Equation (1). Multiply by b.
The integer part of the result is the coeffcient c1.
If the remaining part is zero, we are finished.
If the remaining part is not zero, multiply that by b.
The integer part of the result is c2. If the remaining part is zero, stop; else continue.
Let us see why this works. Consider Equation (1) again.
bN = c1 + q1, where q1 = c2b-1 +c3b-2 +c4b-3 +
bq1 = c2 + q2
bqn-1 = cn + qn,
where we continue until qn = 0.
Convert 0.37510 in to base 2 and base 5.
2N = 2×0.375 = 0.75 = 0 + 0.75 →→ c1 = 0 and q1 = 0.75
2q1 = 1.5 = 1 + 0.5 →→ c2 = 1 and q2 = 0.5
2q2 = 1 = 1 + 0 →→ c3 = 1 and q3 = 0.
When a q-value is 0, we STOP.
So, 0.37510 = (0.c1c2c3)2 = 0.0112.
Similarly for base 5, we start with N = 0.375
5N = 5×0.375 = 1.875 = 1 + 0.875 →→ c1 = 1 and q1 = 0.875
5q1 = 4.375 = 4 + 0.375 →→ c2 = 4 and q2 = 0.375
Since q2 = N, the computation repeats without ever stoppping, and we get
0.37510 = (0.c1c2c1c2)5 = (0.1414 )5.
Having understood the principle behind the algorithm, we can now simply compute the binary version of the fraction 0.37510 as follows:
There is another way to convert a decimal fraction to binary. That is to first express the fraction as a ratio. Thus 0.37510 = (375/1000)10 = (111111111/11111011000)2 and then do the division in binary. As you can see, the above Multiplication method is easier, although it initially took a bit longer to understand.
Now that we know how to convert a fraction from DECIMAL to any other base, how about converting a fraction from any integer base to any other integer base? The case we presented is a special case, namely, from decimal fraction to fraction in any base.
Converting a fraction between bases
Let us consider converting 0.0112 to the corresponding fraction in base 5. From the discussion above, we know how to do this by first converting 0.0112 to decimal and then converting the decimal to base 5. But this goes via the decimal. A direct conversion is to multiply 0.0112 with 5 expressed in base 2. We get 0.0112 ×1012 = 1.1112. The integer part is 1. This is the coefficient c1 for our fraction in base 5.
CONTINUE WITH THE NON-INTEGER PART AND MULTIPLY IT BY 5 EXPRESSED IN BASE 2: 0.1112×1012 = 100.0112. The integer part is 4 in base 5. This is the coefficient c2 for our fraction in base 5. Continue. But the remaining non-integer part is 0.0112 which is what we started with; so the coefficients repeat; and we get 0.0112 = 0.1414 5