You are on page 1of 1

To see this algorithm in action, let's see how this works for the conversion of 0.75.

A table is shown below showing each


iteration as it progresses.

Iteration Calculation >= 1.0? Output Bit


1 0.75 * 2 = 1.5 yes 1
2 0.5 * 2 = 1.0 yes 1

Final value: (top-to-bottom, left-to-right) 11


In this case, the algorithm terminated with a precise result (it reached exactly 1.0).

Another example follows, this time for the conversion of 0.68:

Iteration Calculation >= 1.0? Output Bit


1 0.68 * 2 = 1.36 yes 1

2 0.36 * 2 = 0.72 no 0
3 0.72 * 2 = 1.44 yes 1
4 0.44 * 2 = 0.88 no 0
5 0.88 * 2 = 1.76 yes 1
6 0.76 * 2 = 1.52 yes 1
7 0.52 * 2 = 1.04 yes 1
8 0.04 * 2 = 0.08 no 0

9 0.08 * 2 = 0.16 no 0
10 0.16 * 2 = 0.32 no 0
11 0.32 * 2 = 0.64 no 0
12 0.64 * 2 = 1.28 yes 1
13 0.28 * 2 = 0.56 no 0

14 0.56 * 2 = 1.12 yes 1


15 0.12 * 2 = 0.24 no 0
16 0.24 * 2 = 0.48 no 0
17 0.48 * 2 = 0.96 no 0
18 0.96 * 2 = 1.92 yes 1
19 0.92 * 2 = 1.84 yes 1
20 0.84 * 2 = 1.68 yes 1
21 0.68 * 2 = 1.36 yes 1

22 0.36 * 2 = 0.72 no 0
23 0.72 * 2 = 1.44 yes 1

You might also like