* The value of Pi, π = 3.1415926...10 decimal, which is equivalent to binary 11.001001000011111...2. When represented in a computer that allocates 17 bits for the mantissa, it will become 0.11001001000011111 × 2. Hence the floating point representation would starts with bits 01100100100001111 and end with bits 10 (which represent the exponent 2 in the binary system). Note: the first zero indicate a positive number, the ending 102 = 210.) |
* The value of Pi, π = 3.1415926...10 decimal, which is equivalent to binary 11.001001000011111...2. When represented in a computer that allocates 17 bits for the mantissa, it will become 0.11001001000011111 × 22. Hence the floating point representation would starts with bits 01100100100001111 and end with bits 10 (which represent the exponent 2 in the binary system). Note: the first zero indicate a positive number, the ending 102 = 210.) |
As an example, a floating point number with four decimal digits could be used to represent 4321 or 0.00004321, but would round 432.123 to 432.1 and 43212.3 to 43210. Of course in practice the number of digits is often larger than four.
In floating point represenation, the number is divided into three parts. A sign bit to indicate negative numbers, a certain number of bits are allocated to represent the mantissa and the remaining of the bits are allocated to represent the exponent. The exponent is usually represented as an binary integer using 2's complement notation. The radix point and the base of 2 are understood and not included in the representation.
Similar to scientific notation, floating point number is normalized so that the first digit after the radix point is always non-zero. For example, 2210 = 101102. When this number is represented in floating point, it becomes 0.10112 × 25. The radix point is understood and the base is understood and hence the number is represented as 0 in the sign bit, 10112 in the mantissa and 510 or 1012 in the exponent, or 0101100......00101 where the ... are zeros filled to the precision of the computer number system, the bits in front are the sign bit and mantissa, the bits at the back are for the exponent.
The IEEE have standized the computer representation in IEEE 754. This standard is followed by almost all modern machines. The only exceptions are IBM Mainframes, which recently acquired an IEEE mode, and Cray vector machines, where the T90 series had an IEEE version, but the SV1 still uses Cray floating point format.