[Math] How to convert 601.0 to IEEE-754 Single Precision

floating point

I am trying to understand how to convert from decimal to IEEE-754 Single Precision binary representation.

I make up a random number which happen to be 601.00

I tried my best to figure it out and this is what I got:

Step 01: I divided 601 by 9 (since 2^9 is the largest power of 2 divisible by my number) so I got 66.7778

Step 02: I have for the exponent 9 + 127 = 136 which is 10001000 in binary.
Step 03: The sign is 0

Right now the representation is: (missing the mantissa)
0 10001000

But what is the mantissa representation for 66.7778 in binary?

Best Answer

In step 1, you determined that $2^9$ is the largest power of $2$ less than your number. It doesn't, and doesn't need to, divide your number. Your calculation of the exponent is fine. Then you need to divide your number by $2^9$, not $9$, giving $1.173828125$. This is the number you need to express in binary for the mantissa. You can also get there converting $601$ to binary and shifting $9$ places right. Since $601_{10}=1001011001_2$, you chop off the leading $1$ (it is assumed that the number is normalized) and your mantissa is $001011001$ and $14$ more zeros to fill $23$ bits.