Added DBL_MAX instead of LONG_MAX