# Convert 24(decimal) to modified IEEE 754 floating point format?

Here's what I have as the tweaked format I'm to use:

• S EEE MMMM (excess 8 format)
• s = sign bit, E = exponent bits, M = mantissa/fraction bits Otherwise, it follows the IEEE 754 in principle. The values:

(-1)^s x 0.0: e == 0, && m == 0

(-1)^s x 0.M x 2^-2: e == 0, && M != 0

(-1)^s x 1.N x 2^(e - 3): 0 < e < 7

(-1)^s x infinity: e == 7 && m == 0

NaN: e == 7 && m != 0

That's the formula I've been provided. I need to change 24(decimal) into a floating point binary value, but I continually end up with NaN. Am I doing something wrong?

It is technically a homework question, so if you don't want to provide an exact answer, I'd still be very appreciative if someone can tell me if I'm doing this right or wrong.

• 24 = 2^4 * (1+1/2). IMHO you are right. This number is not representable. Range of non-infinite numbers is +/- 16-epsilon. – TEMLIB Mar 17 '15 at 20:49
• My instructor made a typo.... but it doesn't seem to resolve the situation any with the corrected version. Now, it's "excess-3". – s_werbermanjensen Mar 18 '15 at 3:43
• Standard IEEE single is named "Excess 127". 1 is represented as 2^(127-127). Or maybe he meant excess "minus" three ? – TEMLIB Mar 18 '15 at 21:47
• The formula he gave indicates I hit on my proper exponent through desired e + 3, but that still doesn't work as to obtain 2^4, I would have to use EEE 111 which indicates a NaN with a mantissa.... :s – s_werbermanjensen Mar 18 '15 at 23:49

Since $e=111$ is saved for indicating NaN and $\infty$, then the maximal number that can be represented with this 8bit-floating point structure is $$(-1)^0 \cdot (1.1111)_b \cdot 2^{6-3} = 15.5$$
However, the correct translation would be infinity rather than a NaN, that is, 24 should be represented as $0\ 111\ 0000 \equiv \infty$.