Take the 2-minute tour ×

How can I convert the number 123.45678 * 10^-22 to the IEEE 745 single-precision floating point representation? Can you show me the steps?

share|improve this question
See stackoverflow.com/questions/3448777/… –  paxdiablo Nov 25 '11 at 14:53
add comment

1 Answer

Basically you want binary scientific notation. That is, you want your number to be of the form 2α, and you need to split α into its integral and its fractional part, α = k + β, with β < 1 and k ∈ ℤ.

To find α, take logarithms: α = log2123.45678 − 22 log210.

The integral part of the exponent, k, is stored in the exponent field of the IEEE float (after adjusting by the bias), and the fractional part 2β is stored in the mantissa (omitting the leading 1).

share|improve this answer
add comment

Your Answer


