Move all floats to doubles

The code was developed initially around a pid loop implemented using
floats.  Therefore, the code was converting back and forth between
double for sensor values as inputs and outputs from this PID loop.

Change-Id: I2d2919e1165103040729c9f16bb84fde3dd6b81b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/controller_mock.hpp b/test/controller_mock.hpp
index c0af859..94c7cb5 100644
--- a/test/controller_mock.hpp
+++ b/test/controller_mock.hpp
@@ -14,7 +14,7 @@
     {
     }
 
-    MOCK_METHOD0(inputProc, float());
-    MOCK_METHOD0(setptProc, float());
-    MOCK_METHOD1(outputProc, void(float));
+    MOCK_METHOD0(inputProc, double());
+    MOCK_METHOD0(setptProc, double());
+    MOCK_METHOD1(outputProc, void(double));
 };
diff --git a/test/pid_fancontroller_unittest.cpp b/test/pid_fancontroller_unittest.cpp
index 57932c9..ad646bf 100644
--- a/test/pid_fancontroller_unittest.cpp
+++ b/test/pid_fancontroller_unittest.cpp
@@ -234,9 +234,9 @@
     // Grab pointer for mocking.
     SensorMock* sm1 = reinterpret_cast<SensorMock*>(s1.get());
 
-    // Converting from float to double for expectation.
-    float percent = 80;
-    double value = static_cast<double>(percent / 100);
+    // Converting from double to double for expectation.
+    double percent = 80;
+    double value = percent / 100;
 
     EXPECT_CALL(z, getSensor(StrEq("fan0"))).WillOnce(Return(s1.get()));
     EXPECT_CALL(*sm1, write(value));
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp
index 880864d..e3c4f09 100644
--- a/test/pid_stepwisecontroller_unittest.cpp
+++ b/test/pid_stepwisecontroller_unittest.cpp
@@ -24,7 +24,7 @@
     initial.positiveHysteresis = 2.0;
     initial.reading[0] = 20.0;
     initial.reading[1] = 30.0;
-    initial.reading[2] = std::numeric_limits<float>::quiet_NaN();
+    initial.reading[2] = std::numeric_limits<double>::quiet_NaN();
     initial.output[0] = 40.0;
     initial.output[1] = 60.0;
 
@@ -59,7 +59,7 @@
     initial.positiveHysteresis = 2.0;
     initial.reading[0] = 20.0;
     initial.reading[1] = 30.0;
-    initial.reading[2] = std::numeric_limits<float>::quiet_NaN();
+    initial.reading[2] = std::numeric_limits<double>::quiet_NaN();
     initial.output[0] = 40.0;
     initial.output[1] = 60.0;
 
diff --git a/test/pid_thermalcontroller_unittest.cpp b/test/pid_thermalcontroller_unittest.cpp
index 97550f8..6da309f 100644
--- a/test/pid_thermalcontroller_unittest.cpp
+++ b/test/pid_thermalcontroller_unittest.cpp
@@ -19,7 +19,7 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {"fleeting0"};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
@@ -35,7 +35,7 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
@@ -51,7 +51,7 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {"fleeting0", "asdf"};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
@@ -66,7 +66,7 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {"fleeting0"};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
@@ -85,7 +85,7 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {"fleeting0"};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
@@ -102,14 +102,14 @@
     ZoneMock z;
 
     std::vector<std::string> inputs = {"fleeting0"};
-    float setpoint = 10.0;
+    double setpoint = 10.0;
     ec::pidinfo initial;
 
     std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
         &z, "therm1", inputs, setpoint, initial);
     EXPECT_FALSE(p == nullptr);
 
-    float value = 90.0;
+    double value = 90.0;
     EXPECT_CALL(z, addRPMSetPoint(value));
 
     p->outputProc(value);
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 0b9aa9f..239a04a 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -42,8 +42,8 @@
     bool defer = true;
     const char* objPath = "/path/";
     int64_t zone = 1;
-    float minThermalRpm = 1000.0;
-    float failSafePercent = 0.75;
+    double minThermalRpm = 1000.0;
+    double failSafePercent = 0.75;
 
     int i;
     std::vector<std::string> properties;
@@ -92,8 +92,8 @@
     sdbusplus::SdBusMock sdbus_mock_host;
     sdbusplus::SdBusMock sdbus_mock_mode;
     int64_t zoneId = 1;
-    float minThermalRpm = 1000.0;
-    float failSafePercent = 0.75;
+    double minThermalRpm = 1000.0;
+    double failSafePercent = 0.75;
     bool defer = true;
     const char* objPath = "/path/";
     SensorManager mgr;
@@ -125,7 +125,7 @@
 
     // At least one value must be above the minimum thermal setpoint used in
     // the constructor otherwise it'll choose that value
-    std::vector<float> values = {100, 200, 300, 400, 500, 5000};
+    std::vector<double> values = {100, 200, 300, 400, 500, 5000};
     for (auto v : values)
     {
         zone->addRPMSetPoint(v);
@@ -148,7 +148,7 @@
     // Tests adding several RPM setpoints, however, they're all lower than the
     // configured minimal thermal set-point RPM value.
 
-    std::vector<float> values = {100, 200, 300, 400, 500};
+    std::vector<double> values = {100, 200, 300, 400, 500};
     for (auto v : values)
     {
         zone->addRPMSetPoint(v);
diff --git a/test/zone_mock.hpp b/test/zone_mock.hpp
index 79947fb..35a6b32 100644
--- a/test/zone_mock.hpp
+++ b/test/zone_mock.hpp
@@ -12,9 +12,9 @@
     virtual ~ZoneMock() = default;
 
     MOCK_METHOD1(getCachedValue, double(const std::string&));
-    MOCK_METHOD1(addRPMSetPoint, void(float));
-    MOCK_CONST_METHOD0(getMaxRPMRequest, float());
+    MOCK_METHOD1(addRPMSetPoint, void(double));
+    MOCK_CONST_METHOD0(getMaxRPMRequest, double());
     MOCK_CONST_METHOD0(getFailSafeMode, bool());
-    MOCK_CONST_METHOD0(getFailSafePercent, float());
+    MOCK_CONST_METHOD0(getFailSafePercent, double());
     MOCK_METHOD1(getSensor, Sensor*(const std::string&));
 };