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?
DBL_MIN is the smallest positive normal double . DBL_TRUE_MIN is the smallest positive double (since C++17). It will be smaller than DBL_MIN when double supports subnormals. Follow this answer to receive notifications.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With