diff --git a/tests/grib_lam_bf.c b/tests/grib_lam_bf.c index 81b9ec137..c07ecc393 100644 --- a/tests/grib_lam_bf.c +++ b/tests/grib_lam_bf.c @@ -768,7 +768,16 @@ int main(int argc, char* argv[]) GRIB_CHECK(grib_set_long(h, "biFourierResolutionSubSetParameterM", trunc[itrunc].subnmsmax), 0); GRIB_CHECK(grib_set_long(h, "biFourierSubTruncationType", trunc[itrunc].subtrunc), 0); GRIB_CHECK(grib_set_long(h, "biFourierPackingModeForAxes", 1), 0); - GRIB_CHECK(grib_set_long(h, "unpackedSubsetPrecision", 2), 0); + /* "unpackedSubsetPrecision" value is used for "ieee_floats". + ieee_floats=2 means bytes=8 and grib_long_to_ieee64 is used, which is supported + only when sizeof(double) == sizeof(long) + */ + long unpackedSubsetPrecision; + if (sizeof(double) == sizeof(long)) + unpackedSubsetPrecision = 2; + else + unpackedSubsetPrecision = 1; + GRIB_CHECK(grib_set_long(h, "unpackedSubsetPrecision", unpackedSubsetPrecision), 0); len = trunc[itrunc].len; GRIB_CHECK(grib_set_double_array(h, "values", trunc[itrunc].values, len), 0);