0
$\begingroup$

Im learning how the mantisse and exponent are working in the float representation

Ivve managed to catch the idea from here

however i have a problem analyzing a value.

from this picture : enter image description here

please look at line #7 (at the right side).

they wrote :

2^(-126)  = 1.18*10^(-38) 

how did they do this conversion ?

can you please specify the steps for me to future convertion ? (like this)

  • 0
    @KarolisJuodelė im asking about that approximation......but i cant understand it.2012-06-01

1 Answers 1

1

$2^k = (10^{\log_{10}(2)})^k = 10^{\lfloor \log_{10}(2) \cdot k \rfloor + \varepsilon} = 10^{\varepsilon} \times 10^{\lfloor \log_{10}(2) \cdot k \rfloor} $

where $\lfloor \cdot \rfloor$ means round to $-\infty$ and $\varepsilon \in [0, 1)$ is the remaining fractional part of the exponent. Then $10^{\varepsilon} \in [1, 10)$. For $k= -126$ you get $\log_{10}(2) \cdot -126 \approx -37.9298$ and so

$2^{-126} \approx 10^{0.0702} \times 10^{-38} \approx 1.175 \times 10^{-38}.$

  • 0
    $k \cdot \log_{10} 2$ is a real number, while the scientific notation requires an integer. $\varepsilon$ is the fractional part of this number.2012-06-01