To summarize, the following steps are used to convert a decimal number to
IEEE single format:
1. The leading bit of the floating point format is 0 for a positive number
and 1 for a negative number.
2. Write the unsigned number in binary.
3. Write the binary number in binary scientific notation f23.f22 ... f0 2^e,
where f23 = 1. There are 24 fraction bits, but it is not necessary to write
trailing 0's.
4. Add a bias of 127 to the exponent e. This sum, in binary form, is the
next 8 bits of the answer, following the sign bit. (Adding a bias is an
alternative to storing the exponent as a signed number.)
5. The fraction bits f22f21 ... f0 form the last 23 bits of the floating point
number. The leading bit f23 (which is always 1) is dropped.
Partager