Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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)

share|improve this question
    
Are you asking about converting the bit string to $2^{-126}$ or converting $2^{-126}$ to $1.18 \cdot 10^{-38}$? The former is explained here: en.wikipedia.org/wiki/Single_precision_floating-point_format The latter is just a primitive approximation. –  Karolis Juodelė Jun 1 '12 at 16:17
    
@KarolisJuodelė im asking about that approximation......but i cant understand it. –  Royi Namir Jun 1 '12 at 18:48

1 Answer 1

up vote 1 down vote accepted

$$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}.$$

share|improve this answer
    
can ypu please explain 10^{\lfloor \log_{10}(2) \cdot k \rfloor + \varepsilon} ? –  Royi Namir Jun 1 '12 at 18:38
    
$k \cdot \log_{10} 2$ is a real number, while the scientific notation requires an integer. $\varepsilon$ is the fractional part of this number. –  Karolis Juodelė Jun 1 '12 at 18:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.