Error handling: Add a user-friendly error message

This commit is contained in:
Shahram Najm 2022-07-29 17:03:19 +01:00
parent 0eb43c66f5
commit ceefeea428
1 changed files with 5 additions and 1 deletions

View File

@ -306,8 +306,12 @@ int grib_nearest_smaller_ieee_float(double a, double* ret)
init_table_if_needed();
if (a > ieee_table.vmax)
if (a > ieee_table.vmax) {
grib_context* c = grib_context_get_default();
grib_context_log(c, GRIB_LOG_ERROR,
"Number is too large: x=%e > xmax=%e (IEEE float)", a, ieee_table.vmax);
return GRIB_INTERNAL_ERROR;
}
l = grib_ieee_nearest_smaller_to_long(a);
*ret = grib_long_to_ieee(l);