Why is FLT_MIN equal to zero?

前端 未结 4 1274
情歌与酒
情歌与酒 2020-12-01 07:47

limits.h specifies limits for non-floating point math types, e.g. INT_MIN and INT_MAX. These values are the most negative and most pos

4条回答
  •  不知归路
    2020-12-01 08:19

    Why is FLT_MIN equal to zero?

    It is not, it appears as 0.000000 due to using "%f" which prints 6 decimal digits after the ..
    FLT_MIN often has a value about 1.17549435e-38.


    Reference

    Although this question has been answered as to why, I thought I would post the exact values for FLT_TRUE_MIN, FLT_MIN, FLT_MAX as well as their nearest float neighbors when float is binary32.

    // Approximate value, exact value
    Before, FLT_TRUE_MIN, after
     0.00000000e+00 0.0
     1.40129846e-45 0.00000000000000000000000000000000000000000000140129846432481707092372958328991613128026194187651577175706828388979108268586060148663818836212158203125
     2.80259693e-45 0.0000000000000000000000000000000000000000000028025969286496341418474591665798322625605238837530315435141365677795821653717212029732763767242431640625
    Before, FLT_MIN, after
     1.17549421e-38 0.00000000000000000000000000000000000001175494210692441075487029444849287348827052428745893333857174530571588870475618904265502351336181163787841796875
     1.17549435e-38 0.000000000000000000000000000000000000011754943508222875079687365372222456778186655567720875215087517062784172594547271728515625
     1.17549449e-38 0.00000000000000000000000000000000000001175494490952133940450443629595204006810278684798281709160328881985245648433835441437622648663818836212158203125
    Before, FLT_MAX, after
     3.40282326e+38 340282326356119256160033759537265639424.0
     3.40282347e+38 340282346638528859811704183484516925440.0
                inf inf
    

提交回复
热议问题