ui: replace static_cast<int> with std::nearbyint for convert & rounding (#1313)

* ui: replace `static_cast<int>` with `std::nearbyint` for precise rounding

* revert
This commit is contained in:
Jason Wen
2025-10-03 17:46:13 -04:00
committed by GitHub
parent 1bfecbc9c2
commit e999839a57
@@ -7,6 +7,7 @@
#pragma once
#include <cmath>
#include <map>
#include <optional>
#include <string>
@@ -500,7 +501,7 @@ private:
int getParamValueScaled() {
const auto param_value = QString::fromStdString(params.get(key));
return static_cast<int>(param_value.toFloat() * 100);
return std::nearbyint(param_value.toFloat() * 100.0f);
}
void setParamValueScaled(const int new_value) {