I want to convert $\frac{2}{7}$ to a binary number in a $32$ bit computer. That is, $1$ bit is assigned to the sign of the number, $8$ bits are assigned to the exponent, and $23$ bits are assigned to the mantissa.


So $x = \pm q \times 2^{m}$ where $\frac{1}{2} \leq q < 1$ (if $x \neq 0$) and $m = e - 127$ is an integer. Suppose the leading binary digit $1$ is shifted just to the left of the binary point. In this case, the representation would be $q = (1.f)_{2}$ and $1 \leq q < 2$. So in effect, the machine has a $24$-bit mantissa.

The binary representation of $\frac{2}{7}$ is $\left ( 0.010 \overline{010} \right )_{2}$. In normalized notation, this is $ \left ( 0.10\overline{010} \right )_{2} \times 2^{-1}$. 


I want to write out fully what this number would like in the $32$ bit computer. So, I should write out $24$ bits for the mantissa.

$$x = \left ( 0.\underbrace{10010010010010010010010}_{23 \text{ bits}}\underbrace{\_}_{24\text{'th bit}} \right )_{2} \times 2^{-1}$$

For the $24th$ bit, do I put a $0$? There is not enough room for the entire $3$-period of $\overline{010}$ so what do I do? 

$\textbf{Answer: }$ Let $x_{-}$ denote the chopped number (disgard all bits after the $24$th bit) and let $x_{+}$ denote the rounded number (increase the value of the last bit by one unit). The number $x_{-}$ or $x_{+}$ stored on the $32$ bit computer is the number closest to $x$.

$$|x_{+} - x| = 0.\underbrace{0 \cdots 0}_{23 \text{ zeros}} 110\overline{010} \times 2^{-1} = 0.110\overline{010} \times 2^{-24} = \frac{2}{7} \times 2^{-23}$$

$$|x - x_{-}| = 0.\underbrace{ 0 \cdots 0}_{24 \text{ zeros} }10\overline{010} \times 2^{-1} = 0.10\overline{010} \times 2^{-25} = \frac{2}{7} \times 2^{-24}$$

So $x_{-}$ is closer to $x$.