ECC-455: Set of missingValue key in grib_filter not working as expected

This commit is contained in:
Shahram Najm 2023-03-12 19:25:34 +00:00
parent e411d10cc3
commit 6442533f5f
1 changed files with 7 additions and 1 deletions

View File

@ -87,6 +87,12 @@ static void init_class(grib_expression_class* c)
static int evaluate_long(grib_expression* g, grib_handle* h, long* lres) static int evaluate_long(grib_expression* g, grib_handle* h, long* lres)
{ {
grib_expression_double* e = (grib_expression_double*)g; grib_expression_double* e = (grib_expression_double*)g;
if ( (long)(e->value) != e->value) {
grib_context_log(h->context, GRIB_LOG_ERROR,
"Converting %g to an integer leads to a possible loss of precision", e->value);
return GRIB_WRONG_CONVERSION;
}
*lres = e->value; *lres = e->value;
return GRIB_SUCCESS; return GRIB_SUCCESS;
} }