Why Single Epsilon value is 1.401298E-45

允我心安 提交于 2021-02-10 05:54:05

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/60556995/why-single-epsilon-value-is-1-401298e-45

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!