1
$\begingroup$

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.

$\endgroup$
4
  • $\begingroup$ 24 = 2^4 * (1+1/2). IMHO you are right. This number is not representable. Range of non-infinite numbers is +/- 16-epsilon. $\endgroup$
    – Grabul
    Mar 17, 2015 at 20:49
  • $\begingroup$ My instructor made a typo.... but it doesn't seem to resolve the situation any with the corrected version. Now, it's "excess-3". $\endgroup$ Mar 18, 2015 at 3:43
  • $\begingroup$ Standard IEEE single is named "Excess 127". 1 is represented as 2^(127-127). Or maybe he meant excess "minus" three ? $\endgroup$
    – Grabul
    Mar 18, 2015 at 21:47
  • $\begingroup$ 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 $\endgroup$ Mar 18, 2015 at 23:49

1 Answer 1

2
$\begingroup$

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$$

Therefore, you cannot represent 24(Dec) using the above system.

However, the correct translation would be infinity rather than a NaN, that is, 24 should be represented as $0\ 111\ 0000 \equiv \infty$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.