From 401929d99216b6bcac451e6555dae7fd6e13c7c1 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 19 Sep 2021 21:28:21 +0200 Subject: [PATCH] round2 use float instead of double (6 point precision is enough) --- src/helpers.cpp | 2 +- src/helpers.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 949326686..7439c70ed 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -359,7 +359,7 @@ uint16_t Helpers::atoint(const char * value) { // rounds a number to 2 decimal places // example: round2(3.14159) -> 3.14 -double Helpers::round2(double value, const uint8_t divider) { +float Helpers::round2(float value, const uint8_t divider) { uint8_t div = (divider ? divider : 1); // prevent div-by-zero if (value >= 0) { diff --git a/src/helpers.h b/src/helpers.h index b78d62f5e..9a3518622 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -50,7 +50,7 @@ class Helpers { static uint16_t atoint(const char * value); static bool check_abs(const int32_t i); static uint32_t abs(const int32_t i); - static double round2(double value, const uint8_t divider); + static float round2(float value, const uint8_t divider); static std::string toLower(std::string const & s); static std::string toUpper(std::string const & s);