I assign 0.4543543234343654632452452525254e-323
to a double
variable a
and print it, although it is less than DBL_MIN
, it can still be assigned and printed.
DBL_MAX: 1.79769e+308
FLT_MAX: 3.40282e+38
DBL_MIN: 2.22507e-308
FLT_MIN: 1.17549e-38
a: 4.94066e-324
Why this happens?
Actually DBL_MIN
is not the smallest value but the smallest normalized value that is representable.
The difference is the leading digit with is 1 for normalized values, while it's 0 for denormal numbers. Mind that denormal numbers could suffer from sever performance issues on hardware with floating processing unit which is not able to manage them in hardware.
But your value, 0.454354e-323
, which corresponds to 4.545354e-324
is smaller than the smallest denormal number representble with a double
, indeed it gets rounded to 4.94066e-324
which is the real smallest number which can be stored in a double
.