# Converting decimal number to a floating point system

I am trying to convert $$1.5\times10^{8}$$ to a normalized floating point system defined as $$0.d_1d_2d_3...d_t\times B^c$$ for $$t=20, B=2$$

I don't know how I can change my base 10 to a base 2 without getting a non-integer value for $$c$$ (I am not sure if c has to be an integer value or not).

To get $$t=20$$, I could do something crazy like $$0.15000000000000000000\times10^9$$. But then again my problem arises from trying to convert my base. I do not know what the right way is to approach this problem.

For the exponent $$c$$ that has indeed to be integer, you compute the next largest integer to the binary logarithm, $$\log_2(1.5\cdot 10^8)=27.160..$$ Then for the mantissa you need the integer part of $$1.5\cdot 10^8\cdot 2^{20-28}=585937.5$$. Now to get the digits you need to convert this decimal number to binary. One step there could be the hexadecimal form $${\tt 8F0D2}$$.