#include <float.h>
// could also be your custom consant
// see also http://stackoverflow.com/a/77735/213682
// also this http://stackoverflow.com/a/2729750/213682
const double my_epsilon = DBL_MIN;
double val(double x, double y)
{
double denom = x*x + y*y;
if (denom < my_epsilon) {
return 0.0; // or some other value indicating an error
}
return 1.0 / denom;
}
在我的机器上,1.0 / DBL_MIN
给出了一个强大的数字:
44942328371557897693232629769725618340449424473
55766431835752028943316895137524078317711933060
18840052800284699678483394146974422036041556232
11857659868531094441973356216371319075554900311
52352986327073802125144220953767058561572036847
82776352068092908376276711465745599868114846199
29076208839082406056034304.000000