I'm trying the understand the concept of how floating number are stored in the computer. While trying to understand it I ran into following kind of transformations:
$2^{-n} \approx x \times 10^{-m}$
For example:
$2^{-1074} \approx 5 \times 10^{-324}$
Can you please explain me how this transformation from the base 2 expression to the base 10 expression is being performed?
Thanks in advance
$$2^{-n} = 10^{\log_{10}(2^{-n})} = 10^{-n \log_{10}(2)} \simeq 10^{-0.301n}.$$
Now, suppose that $n=42$. Then:
$$2^{-42} \simeq 10^{-12.643} = 10^{-0.643} \cdot 10^{-12} = x \cdot 10^{-m},$$
where
$x = 10^{-0.643}, m = 12$.
In general:
$$m = \text{int}(0.301n),$$ $$x = 10^{-(0.301n-m)},$$
where $\text{int}(\ldots)$ denotes the integer part of a number.