|
|
|
|
|
|
|
|
|
|
|
|
Converting number bases:
repeating fractions |
|
|
|
|
Given: decimal fraction
representation |
|
|
|
Find: binary
representation |
|
|
|
|
|
|
value: |
0.20ten |
|
|
|
b-1 |
b-2 |
b-3 |
b-4 |
b-5 |
|
|
|
|
weight |
|
0.5 |
0.25 |
0.125 |
0.0625 |
0.03125 |
|
|
|
|
digit |
0. |
0 |
0 |
1 |
1 |
0 |
|
|
|
|
|
|
|
|
Sometimes, a fraction may
not be exactly represented: |
|
|
|
|
1/3ten = (0.3333 . . .)ten |
|
|
|
|
|
0.2ten |
= b-1 * 2-1 + b-2 * 2-2 + b-3 * 2-3 + b-4 * 2-4 + etc. |
|
|
|
|
If we multiply by 2, |
|
|
|
|
0.4 |
= b-1* 20 + b-2 * 2-1 + b-3 * 2-2 + b-4 * 2-3 + etc. |
|
|
Multiply by 2 again, |
|
|
|
|
0.8 |
= b-2 * 20 + b-3 * 2-1 + b-4 * 2-2 + etc. |
|
|
|
|
1.6 |
= b-3 * 20 + b-4 * 2-1 + etc. |
|
|
|
|
0.6 |
= b-4 * 2-1 + b-5 * 2-2 |
|
|
|
|
1.2 |
= b-4 * 20 + b-5 * 2-1 |
|
|
|
|
0.2 |
= b-5 * 2-1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|