2
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

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!).

$\endgroup$
  • $\begingroup$ Oh I see!! Thanks for the answer! So when we want to represent a number under a machine epsilon, an exponent of zeroes+mantissa represents 0.mantissa? $\endgroup$ – Jin Mar 7 '16 at 14:47
  • $\begingroup$ That's right. These are the mysterious denormalized numbers. $\endgroup$ – Yuval Filmus Mar 7 '16 at 14:48
  • $\begingroup$ @jin A little bit of nitpicking. Significand: "However, this use of mantissa is discouraged by the IEEE floating-point standard committee and by some professionals such as William Kahan and Donald Knuth, because it conflicts with the pre-existing use of mantissa for the fractional part of a logarithm (see also common logarithm)". $\endgroup$ – Anton Trunov Mar 7 '16 at 15:05
  • $\begingroup$ @YuvalFilmus When all exponents are 0, then does the exponent become 2^(-1022) or 2^(-1023) when represented in numbers of base 10? $\endgroup$ – Jin Mar 12 '16 at 8:54
  • $\begingroup$ Fortunately, this is covered in the ample documentation on the standard. $\endgroup$ – Yuval Filmus Mar 12 '16 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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