
## Section16.2Programming Exercise

##### 1

Develop an algorithm to convert fractional binary numbers to decimal.

Hint

Multiply both sides of the fractional part of Equation (16.1.1) by $2\text{.}$

Solution

Refer to Equation (16.1.1).

• $i = -1$
• While ($F \ne 0$) AND (want-more-bits)

• $F = 2 \times F$

• $d_{i} = int(F)$

• $F = F - d_{i}$

• $i = i - 1$