Search code examples
decimalieee-754normalize

Equation to convert IEEE754 to decimal (normalised form)


Any help will be greatly appreciated! I have been working with IEEE754 floating point numbers(32-bit single precision), and i am trying to convert it to decimal normalised format. I have found two equations to do it, but i'm not sure which one is correct.

N= (-1)^s * 1.F *2^(e-127) 
    OR 
    N= (-1)^s * 1+F * 2^(e-127) 

s= sign bit
F= fraction/mantissa
e=exponent

which of the above equation is correct ? in other words is it 1*F or 1+F ?


Solution

  • Been a while since I've done floating point conversion, but that is a plus, not multiply (So 1+F, NOT 1*F).

    The wikipedia article on the subject is pretty good and also says it's a plus: https://en.wikipedia.org/wiki/Single-precision_floating-point_format

    From Iowa state with more concise description: http://class.ece.iastate.edu/arun/CprE281_F05/ieee754/ie5.html

    Another interesting way to solve it: How to convert an IEEE 754 single-precision binary floating-point to decimal?