I compiled a test setup for the BMP388 on a 16-bit MCU. Sensor readout worked fine, but the compensated temperature and pressure readings were far off (142 instead of 25 degrees). Then I defined BMP3_DOUBLE_PRECISION_COMPENSATION, which solved the issue: temp and pressure readings were good.
Investigation a bit, I came to the conclusion that the error is in the temp/pressure compensation functions (integer version) in bmp3.c.
In bmp3.c, static int64_t compensate_temperature(), line 2452:
partial_data1 = ((int64_t)uncomp_data->temperature - (256 * calib_data->reg_calib_data.par_t1));
This computation caused an overflow on my 16-bit MCU, because 256 was promoted as int16_t. On a 32-bit MCU, there probably is no overflow occurring, because 256 would be promoted as int32_t. I guess the function was tested on a 32-bit architecture.
I solved the issue by changing explicitely declaring the literal as int32_t:
partial_data1 = ((int64_t)uncomp_data->temperature - ((int32_t)256 * calib_data->reg_calib_data.par_t1));
There are more literals affected further below: lines 2494, 2495:
partial_data5 = (reg_calib_data->par_p2 - (int32_t)16384) * reg_calib_data->t_lin * 2097152; sensitivity = ((reg_calib_data->par_p1 - (int32_t)16384) * 70368744177664) + partial_data2 + partial_data4 + partial_data5;
I don't know how to solve this issue properly to make the API portable, but I think it should be addressed by the Bosch experts.