fix %r format spec

This commit is contained in:
Florian Foinant-Willig
2025-12-13 13:36:43 +01:00
committed by Chris Hennes
parent febfd65e59
commit 7b315e80a7

View File

@@ -315,7 +315,7 @@ QString DimensionFormatter::formatValueToSpec(const double value, QString format
else if (spec == QStringLiteral("r")) {
// round the value to the given precision
double rounder = dec.toDouble();
double roundValue = std::ceil(value / rounder) * rounder;
double roundValue = std::round(value / rounder) * rounder;
// format the result with the same decimal count than the rounder
int dotIndex = dec.indexOf(QStringLiteral("."));
int nDecimals = 0;