I wrote the following C++ code to check for an underflow. Not sure this is a good practice or not.
#include <limits>
#include <iostream>
int main()
{
float d = 1.e-29;
std::cout<<"d: "<<d<<" underflow? "<<(d<std::numeric_limits<float>::min())<<std::endl;
d = 1.e-59;
std::cout<<"d: "<<d<<" underflow? "<<(d<std::numeric_limits<float>::min())<<std::endl;
}
The printouts are
d: 1e-29 underflow? 0
d: 0 underflow? 1