Why Single Epsilon value is 1.401298E-45

Viewed 490

I don't understand why Single epsilon value is 1.401298E-45 and not 1E-126, if internally has an exponent of -126 and a mantissa of 1.

2 Answers

The smallest positive Single value has an exponent of −126 with a base of two and a binary significand of .00000000000000000000001 (2−23), so its value is 2−149, which is approximately 1.4• 10−45.

Remember that IEEE-754 single-precision floats are stored in base 2-representation. This is how the smallest possible positive denormal value for single-precision is laid out:

                  3  2          1         0
                  1 09876543 21098765432109876543210
                  S ---E8--- ----------F23----------
          Binary: 0 00000000 00000000000000000000001
             Hex: 0000 0001
       Precision: SP
            Sign: Positive
        Exponent: -126 (Stored: 0, Bias: 126)
       Hex-float: +0x1p-149

In other words, 126+23 = 149, so its value is 2^-149, which is roughly 1.4E-45.

Related