Mail Archives: djgpp/1997/08/30/18:05:53
At 11:39 AM 8/27/97 GMT, you wrote:
>I recently learned the format of an IEEE float and I am still a bit
>confused. I know all the exceptions like infinity, NaN, etc..., and i know
>how to get the exponent (E-127). The one thing I don't get is how to
>actually get a decimal number from the mantissa. For example, I read that
>6.5 (single precision) in binary is:
>0 10000001 10100000....
>S E M
>
>I know E is 2, but what is the decimal equivilant of M?
>I need this because I'm writing a bunch of functions in DJGPP, and one of
>them is a printf-kinda function, and I will need to convert IEEE's to strings.
>
You need to prepend a 1 to the mantissa (always):
This you have
1.M * 2^(E-127)
1.101000... * 2^2
110.1 base-2
6.5 base-10
- Raw text -