diff --git a/src/gui/properties/speedplotview.cpp b/src/gui/properties/speedplotview.cpp index 7c3677743..8a3d8f255 100644 --- a/src/gui/properties/speedplotview.cpp +++ b/src/gui/properties/speedplotview.cpp @@ -28,9 +28,12 @@ #include "speedplotview.h" +#include + #include #include #include + #include "base/global.h" #include "base/unicodestrings.h" #include "base/utils/misc.h" @@ -85,20 +88,16 @@ namespace calculatedUnit = static_cast(static_cast(calculatedUnit) + 1); } - if (value > 100.0) + if (value > 100) { - int roundedValue = static_cast(value / 40) * 40; - while (roundedValue < value) - roundedValue += 40; - return {static_cast(roundedValue), calculatedUnit}; + const double roundedValue {std::ceil(value / 40) * 40}; + return {roundedValue, calculatedUnit}; } - if (value > 10.0) + if (value > 10) { - int roundedValue = static_cast(value / 4) * 4; - while (roundedValue < value) - roundedValue += 4; - return {static_cast(roundedValue), calculatedUnit}; + const double roundedValue {std::ceil(value / 4) * 4}; + return {roundedValue, calculatedUnit}; } for (const auto &roundedValue : roundingTable)