-1

I am converting C22E8300 from a Single Precision IEEE 754 Floating Point to a decimal.

First, I converted to binary: 1100 0010 0010 1110 1000 0011 ...

Calculated the exponent as 5. The mantissa is 0.24762

How do I finish the conversion now?

Daniel
  • 2,355
  • 9
  • 23
  • 30
  • 2
    I strongly advise you to read more about computer numerical representations and IEEE 754 specification. The work is complex and not to be underestimated. The following link might help you get on the right way (see the FAQ) https://www.h-schmidt.net/FloatConverter/IEEE754.html . It deireclty suggest to look at C standard library source code. By the way, I have doubts concerning the mantissa (unless one of us missed some endianness tricks). – LoneWanderer Nov 19 '18 at 20:12
  • 1
    Your value for the significand (the preferred term instead of “mantissa”) is incorrect. – Eric Postpischil Nov 19 '18 at 20:23

1 Answers1

0

Let s be the first bit, e be the next eight bits (interpreted as a binary numeral), and f be the remaining 23 bits (interpreted as a binary numeral).

If e is zero, the value represented is (−1)sf/223 • 2−126.

If e is 255 and f is zero, the value represented is +∞ or −∞, according to whether s is 0 or 1, respectively.

If e is 255 and f is not zero, the object is a NaN.

Otherwise, the value represented is (−1)s • (1+f/223) • 2e−127.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312