]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Code cleanup.
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index bb64756369d712a801347f06d913d0eb35fc1f7c..7d63b57420cd2f4973f02a29a2413fde10094896 100644 (file)
@@ -29,6 +29,7 @@
 #include <string>
 #include <vector>
 #include <sstream>
+#include <cmath>
 
 #include <libpq-fe.h>
 
@@ -543,8 +544,8 @@ for (int i = 0; i < std::min(tuples, DIR_NUM); ++i)
     tuple >> td->dirPrice[dir].hNight;
     tuple >> td->dirPrice[dir].mNight;
 
-    if (td->dirPrice[dir].priceDayA == td->dirPrice[dir].priceNightA &&
-        td->dirPrice[dir].priceDayB == td->dirPrice[dir].priceNightB)
+    if (std::fabs(td->dirPrice[dir].priceDayA - td->dirPrice[dir].priceNightA) > 1.0e-3 &&
+        std::fabs(td->dirPrice[dir].priceDayB - td->dirPrice[dir].priceNightB) > 1.0e-3)
         {
         td->dirPrice[dir].singlePrice = true;
         }