| commit | fefb585545292cf6fcda696dfadd802d696c9eb5 | [log] [tgz] |
|---|---|---|
| author | Thang Tran <thuutran@amperecomputing.com> | Thu Sep 22 22:20:49 2022 +0700 |
| committer | Thang Tran <thuutran@amperecomputing.com> | Tue Sep 27 02:41:19 2022 +0000 |
| tree | bd6e4e0b69ea6b6ff5436cadbef51f20060d03ea | |
| parent | 548d1a27aa399392c00f9ad27c8990ecd047ca34 [diff] |
replace static converting with rounding
Issue: When the users request to get the sensor thresholds via "ipmitool
sensor get <sensor_name>" command, sometimes the value is not correct.
E.g: The real sensor threshold is 2.01, the "scale" = 0, "exponentR"=-3,
"coefficientM" = 10. After calculating, the ipmid should return 201 to
ipmitool, but the actual return value is 200. Ipmitool displays the
value of the threshold is 2.00.
Root cause: The "float point" can not present exactly the "double" value
in somecase. Therefore, after calculating, the value of sensor
thresholds is incorrect when convert from double to uint8_t.
Solution: Replace static converting with rounding.
Tested:
1. Check the result of the threshold whose value is 2.01
ipmitool sensor get <2.01_Sensor_name>
2. The threshold value is 2.01
Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
Change-Id: I7f3e72640beb76eda9370f60e32f42d2b2c1fbda
meson builddir ninja -C builddir
meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled ninja -C builddir
If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in ipmid/subprojects.
meson builddir -Dwrap_mode=nofallback ninja -C builddir
meson builddir -Dbuildtype=debug ninja -C builddir
meson builddir -Db_coverage=true -Dtests=enabled ninja -C builddir test ninja -C builddir coverage