0
$\begingroup$

I want to convert the number -29.375 to IEEE 745 16-bit floating point format. Here is my solution:

The format of the floating point number is: 1 sign bit unbiased exponent in 4 bits plus a sign bit 10 bits for the mantissa plus the explicit 1

First, I realize that 29.375 = 29 + 3/8.
Then realize that:
29 = 16 +13 = 16 + 8 + 5 = 16 + 8 + 4 + 1 1 1101.011 = 1.1101 0110 * 2^3

This gives us:
mantissa is: 1101 011000
sign: 1
exp: 00011

Hence in 16 bits, we have: 1000111101011000

Do I have this right? I was hoping that there would be a calculator on the web that I could use but I could not find one. They were all at least 32-bits.

$\endgroup$
1
$\begingroup$

First of all, the IEEE 745 16-bit format has:

  • 1 bit for the sign.
  • 5 bits (not 4) for the biased exponent. The bias is $15$.
  • 10 bits for the mantissa. The leading $1$ is implicit (not explicit).

The calculation is incorrect since $(29.375)_2 = (11101.011)_2 = (1.1101011)_2 \cdot 2^4$ (and not $2^3$).

Then:

  • The sign bit is $1$ because the number is negative.
  • The unbiased exponent is $(4)_{10} = (100)_{2}$ and therefore the biased exponent is $(19)_{10} = (10011)_2$.
  • The mantissa, without the implicit leading $1$ and padded to 10 bits with trailing zeros, is $(1101011000)_2$.

Then the final $16$-bit number is: $11001101011000$.

$\endgroup$
2
  • $\begingroup$ The problem was to convert -29.375 to IEEE 745 format. That is, the number is negative. $\endgroup$
    – Bob
    Apr 28 '20 at 12:04
  • $\begingroup$ Ooops sorry! I edited my answer. Everything stays the same except for the first bit. $\endgroup$
    – Steven
    Apr 28 '20 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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