Use equals to compare doubles
Or may be it does make sense to simply check `if (d > 99.8)'.

---

 devices/runtime_pm.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/devices/runtime_pm.cpp b/devices/runtime_pm.cpp
index 07e5d11..0d0c7f5 100644
--- a/devices/runtime_pm.cpp
+++ b/devices/runtime_pm.cpp
@@ -32,6 +32,7 @@
 #include <dirent.h>
 
 #include "../parameters/parameters.h"
+#include "../lib.h"
 
 #include <iostream>
 #include <fstream>
@@ -105,7 +106,7 @@ double runtime_pmdevice::utilization(void) /* percentage */
 
        if (d < 0.00)
                d = 0.0;
-       if (d >= 99.9)
+       if (d > 99.9 || equals(d, 99.9))
                d = 100.0;
        return d;
 }
@@ -235,4 +236,5 @@ void create_all_runtime_pm_devices(void)
        do_bus("spi");
        do_bus("platform");
        do_bus("i2c");
-}
\ No newline at end of file
+}
+

_______________________________________________
Discuss mailing list
[email protected]
http://lists.lesswatts.org/listinfo/discuss

Reply via email to