Let's convert 0.2 to a floating point number with 4 bits for the mantissa and three bits for the exponent. First, let's consider what the teaching tool does.
To describe the input, we have to specify the number as a quotient of integers, e.g., 2/10. The tool first translates these two numbers to radix-2 numbers and reads it as <10>_2 / <1010>_2. It realizes that it needs to scale the division by a factor of 2^7, i.e., to compute +<100000000>_2 / <1010>_2 * 2^{-7} to have sufficiently many digits for the mantissa when doing an integer division. The result of this integer division is now
+<1.1001...0/1...>_2 * 2^{-3}
The meaning of this is as follows: the mantissa is normalized (as you can see it starts with a 1 left of the decimal point). The next three digits given in blue color will be our remaining bits for the mantissa. The next bit given in red color is called the rounding bit; it would be the next bit after our mantissa, and finally the 0/1 given in green color will tell us whether there are futher 1 digits after this one (this is known by the integer division +<100000000>_2 / <1010>_2 by checking the remainder). Sometimes people call the green part the sticky bit in that they provide a bit which is 1 if there are further 1 bits and 0 otherwise.
Now, we either have to choose one of the representable numbers +<1.100>_2 * 2^{-3} or +<1.101>_2 * 2^{-3} since our actual number 0.2 = +<1.1001...0/1...>_2 * 2^{-3} cannot be precisely represented. Which one of the two is chosen depends on the rounding mode, and there we have to consider three cases:
- In case the rounding bit would be 0, then the number would be closer to +<1.100>_2 * 2{-3}.
- However, as the rounding bit is 1, and there are further 1-bits after this (the green ones), our number is closer to +<1.101>_2 * 2{-3}.
- There could also be the third case, where the rounding bit is 1, and there are no further green bits on the right. In that case, the number would be right in the middle of the representable numbers +<1.100>_2 * 2{-3} and +<1.101>_2 * 2{-3}.
The table that follows in the output of the teaching tool tells you the numbers chosen for the different rounding modes.
If we would like to use a hidden bit, we should specify one further bit for the teaching tool, and the omit the leading 1 of the mantissa as the hidden bit.
When are denormal numbers used? They are used when the exponent becomes zero. In that case, we cannot reduce the exponent further to scale the mantissa, and we have to live with a mantissa that is not normalized. Recall that normalizing means that the mantissa is between 1 and 2, i.e., in binary 1.xxxxx. If that cannot be achieved with the exponents that we have, you need to represent the number as a denormal number (or it is an overflow).
Looking at the slides 23-26, you need to compute it as follows: First, normalize the number, i.e., represent it as M*2^{E} such that 1≤M<2 holds. In our case, we get
0.2 = 0.4 * 2^{-1} = 0.8 * 2^{-2} = 1.6 * 2^{-3}
So, we have M = 1.6 and E = -3. With 3 bits for the exponent, we obtain the offet beta .= (2^{3}-1)/2 = 3. Hence, E+beta = -3+3 = 0, and the exponent that we should use is 0, so we will have a denormalize number (indicated by exponent 0).
Now note that 1.6 = 1 + 1/2 + 1/16 + ... which gives us the same information as mentioned above, i.e.
+<1.1001...0/1...>_2 * 2^{-3}
The rest can be explained as before.
Does it help?