World's most popular travel blog for travel bloggers.

Smallest number close to 0 in IEEE754 (64bits)?

, , No Comments
Problem Detail: 

I thought the smallest number close to 0 would be : 0 00000000001 (exponent) 0000000000000000000000000000000000000000000000000000 (significand)

But this site (http://binaryconvert.com/result_double.html?hexadecimal=0000000000000001) shows that the smallest number close to 0 is : 0 00000000000 (exponent) 0000000000000000000000000000000000000000000000000001 (significand) According to what I know, when all components of exponent are 0 then the number must represent 0. Thus, this is not possible! How could this happen?

Asked By : Jin

Answered By : Yuval Filmus

It's not true that when all components of the exponent are 0 then the number must represent 0. A (normalized) floating point number is composed of two parts: sign, exponent, and mantissa. The value of the number is $$ \text{sign} \times 1.\text{mantissa} \times 2^{\text{exponent} + \text{base}}, $$ where the sign is $\pm 1$ (though encoded as a bit), and $\text{base}$ is a constant which depends on the format.

As you can see, $0$ cannot actually be represented at all! Some numbers, like zero, infinity, NaN and denormalized numbers have special representations. Zero, for example, is represented in IEEE 754 (the standard format) using zeroes for both mantissa and exponent.

In IEEE 754, an exponent of zeroes represents a denormalized number. In such numbers, instead of 1.mantissa we have 0.mantissa, and this allows representing numbers which are closer to zero (calculate and see!).

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/54112

3200 people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback