Maximus - 6 months ago 43

Javascript Question

I assumed that the minimal positive value that can be put into double floating point is this

`0 0000000000 00000000000000000000000000000000000000000000000000000`

And in scientific form it's this:

`1 x 2^{-1023}`

However, this article states that:

As mentioned above, zero is not directly representable in the straight

format, due to the assumption of a leading 1 (we'd need to specify a

true zero mantissa to yield a value of zero). Zero is a special value

denoted with an exponent field of all zero bits, and a fraction field

of all zero bits.

So what's the pattern for minival positive value?

Answer

When the exponent part is all zero, the numbers are *subnormals* or *denormals*, where the implicit digit is 0 instead of 1 (the exponent is the same as the smallest normal float). Therefore

```
0 00000000000 0000000000000000000000000000000000000000000000000000
```

is zero, and the next number

```
0 00000000000 0000000000000000000000000000000000000000000000000001
```

is the smallest positive number, being equal to

0.0000000000000000000000000000000000000000000000000001_{2}×2^{-1022} = 2^{-1074} ≈ 5.0×10^{-324}