4
$\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 Answers 2

4
$\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$
5
  • $\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$
    – user47513
    Commented Mar 7, 2016 at 14:47
  • $\begingroup$ That's right. These are the mysterious denormalized numbers. $\endgroup$ Commented Mar 7, 2016 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$ Commented Mar 7, 2016 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$
    – user47513
    Commented Mar 12, 2016 at 8:54
  • $\begingroup$ Fortunately, this is covered in the ample documentation on the standard. $\endgroup$ Commented Mar 12, 2016 at 10:24
0
$\begingroup$

"According to what I know": What often gets us into trouble are the things that we "know", but that aren't so.

A stored exponent of zero means this is a denormalised number. The mantissa has no implicit leading bit but can have any number of bits set, and the mantissa is then scaled the same as if the stored exponent was 1. So the smallest none-zero floating point number is indeed a stored exponent of 0, and a stored mantissa of 1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.