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
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index ffc1ee5..1a24c42 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -701,7 +701,7 @@
         {
             warnLow *= std::pow(10, info.scale - info.exponentR);
             resp.lowerNonCritical = static_cast<uint8_t>(
-                (warnLow - info.scaledOffset) / info.coefficientM);
+                round((warnLow - info.scaledOffset) / info.coefficientM));
             resp.validMask |= static_cast<uint8_t>(
                 ipmi::sensor::ThresholdMask::NON_CRITICAL_LOW_MASK);
         }
@@ -710,7 +710,7 @@
         {
             warnHigh *= std::pow(10, info.scale - info.exponentR);
             resp.upperNonCritical = static_cast<uint8_t>(
-                (warnHigh - info.scaledOffset) / info.coefficientM);
+                round((warnHigh - info.scaledOffset) / info.coefficientM));
             resp.validMask |= static_cast<uint8_t>(
                 ipmi::sensor::ThresholdMask::NON_CRITICAL_HIGH_MASK);
         }
@@ -730,7 +730,7 @@
         {
             critLow *= std::pow(10, info.scale - info.exponentR);
             resp.lowerCritical = static_cast<uint8_t>(
-                (critLow - info.scaledOffset) / info.coefficientM);
+                round((critLow - info.scaledOffset) / info.coefficientM));
             resp.validMask |= static_cast<uint8_t>(
                 ipmi::sensor::ThresholdMask::CRITICAL_LOW_MASK);
         }
@@ -739,7 +739,7 @@
         {
             critHigh *= std::pow(10, info.scale - info.exponentR);
             resp.upperCritical = static_cast<uint8_t>(
-                (critHigh - info.scaledOffset) / info.coefficientM);
+                round((critHigh - info.scaledOffset) / info.coefficientM));
             resp.validMask |= static_cast<uint8_t>(
                 ipmi::sensor::ThresholdMask::CRITICAL_HIGH_MASK);
         }