CompuServe Messages

#IEEE Floating Point

    11-Mar-90 18:06:20
Fm: jon lewanda 72317,1226
To: – Visitor 76114,10
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).)