Representing Numbers in the Floating-Point Format

  1. Analysis for $0.5$: (1) it is positive, so the sign bit will be $0$. (2) We know that $0.5_{10} = \frac{1}{2}_{10} = 2^{-1}_{10} = 0.1_2$. Thankfully, the significand is already in the form $0.1xxxx\dots$, so we just notice that it is equal to $0.1 \times 1 = 0.1 \times 2^0$. As such, the significand will be $10000$. (3) Finally, for the exponent, we stopped at $2^0$, whose exponent is $0$. When we add the bias of $15$, we get $0 + 15 = 15$, which makes our exponent equal to $01111$. The number $0.5$, therefore, in its floating-point form is:
    +---+   +---+---+---+---+---+   +---+---+---+---+---+
    | 0 |   | 0 | 1 | 1 | 1 | 1 |   | 1 | 0 | 0 | 0 | 0 | = 0.5_{10}
    +---+   +---+---+---+---+---+   +---+---+---+---+---+

It's not always easy to recognize powers of $2$ as we did with $0.5$. As such, when we get a fraction in base $10$ and want to find its binary representation, we could use a fraction multiplication trick. It goes as follows: (1) multiply the fraction by $2$, and discard any integer parts (2) in each step, before discarding it, take note of the integer part of the number: whether it is $0$ or $1$, (3) repeat steps (1) and (2) until the fraction is empty (the fraction part is only zeros.) We will use this method for the next examples.