发表于:2006-12-26 09:07:00
4楼
The IEEE 754 floating point formats are broken into three fields. The most significant bit stores the sign of the mantissa, the next group of bits stores the exponent in biased form, and the rest of the bits store the magnitude of the fractional portion of the mantissa. So the number 2.25 would be stored in a basic single-precision number as:
Bit 31, sign Bit 30-23, exponent Bit 22-0, mantissa
0 01111110 001000000000000000000000
The sign bit is as simple as it gets. Zero denotes a positive number; one denotes a negative number. Flipping the value of this bit flips the sign of the number.
The exponent field needs to represent both positive and negative exponents. To do this, a bias is added to the actual exponent in order to get the stored exponent. For IEEE single-precision floats, this value is 127.
The mantissa, also known as the significand, represents the precision bits of the number.