CompuServe Thread

#IEEE Floating Point

3 messages in this thread
#24420From: – VisitorMar 11, 1990 12:44 AM
I am trying to decode a Lotus 1-2-3 file and I find real numbers stored in 64 bit IEEE floating point format. Can anyone tell me how that works? Thanks a lot
#24424From: jon lewandaMar 11, 1990 6:06 PM
Floating point numbers are not real 🙂 easy to work with but here goes: An IEEE 754 Double Precision (64 bit) number has 3 parts: Bit 63 (the MSB) is the sign of the number. Bits 62 – 51 (11 bits) are the biased exponent. Bits 51 – 0 (52 bits) are the normalized mantissa. Example: The hex representation of 178.125 as a floating point number is 4066440000000000. This breaks down as follows (in binary): Sign: 0 (The number is positive. For -178.125, this would be 1, the rest is unchanged.) Exponent: 10000000110 = 406H = 1030; 1030 – 1023 = 7 (1023 is the bias) Mantissa: (1)01100100010000000 … 0 (The first bit is implicit, thus all floating point numbers must be normalized.) Now move the binary point 7 places in the mantissa and we have 10110010 = B2H = 178 for the integer part and the fractional part is .001 or 1/8 (remember we're dealing binary here) or .125 decimal. Hope that helps more than it hurts :-). P.S. For single precision (32 bits) it's the same concept: Bit 31: Sign of mantissa Bits 30 – 23: Biased exponent, bias = 127 Bits 22 – 0: Normalized mantissa (the 1 to the left of the binary point is implicit).)
#24427From: – VisitorMar 11, 1990 8:53 PM
Thanks for the response, jon. Much easier having it explained than figuring it out from the hex! Dave R.