sensorhandler: Support 0 value for thresholds

Currently the threshold value is considered present if its
value is not equal 0. Therefore it is not possible to support
thresholds with a 0 value.
As special IEEE floating point values were added to the interface
it is now possible to represent an unset threshold as 'NaN'.
Consider a threshold present if it is finite (i.e. not NaN or
infinity) as infinity is also not a valid value.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: Ifc4f70b840658b96a70ccd43126de67f873af38c
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 3699871..881ea35 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -495,7 +495,7 @@
     double warnHigh = std::visit(ipmi::VariantToDoubleVisitor(),
                                  warnThresholds["WarningHigh"]);
 
-    if (warnLow != 0)
+    if (std::isfinite(warnLow))
     {
         warnLow *= std::pow(10, info.scale - info.exponentR);
         resp.lowerNonCritical = static_cast<uint8_t>(
@@ -504,7 +504,7 @@
             ipmi::sensor::ThresholdMask::NON_CRITICAL_LOW_MASK);
     }
 
-    if (warnHigh != 0)
+    if (std::isfinite(warnHigh))
     {
         warnHigh *= std::pow(10, info.scale - info.exponentR);
         resp.upperNonCritical = static_cast<uint8_t>(
@@ -515,12 +515,13 @@
 
     auto critThresholds = ipmi::getAllDbusProperties(
         bus, service, info.sensorPath, criticalThreshIntf);
+
     double critLow = std::visit(ipmi::VariantToDoubleVisitor(),
                                 critThresholds["CriticalLow"]);
     double critHigh = std::visit(ipmi::VariantToDoubleVisitor(),
                                  critThresholds["CriticalHigh"]);
 
-    if (critLow != 0)
+    if (std::isfinite(critLow))
     {
         critLow *= std::pow(10, info.scale - info.exponentR);
         resp.lowerCritical = static_cast<uint8_t>(
@@ -529,7 +530,7 @@
             ipmi::sensor::ThresholdMask::CRITICAL_LOW_MASK);
     }
 
-    if (critHigh != 0)
+    if (std::isfinite(critHigh))
     {
         critHigh *= std::pow(10, info.scale - info.exponentR);
         resp.upperCritical = static_cast<uint8_t>(