From 9424359e2d8e682442c9c32132d256f64a76cfdc Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 17 Oct 2026 23:25:28 +0000 Subject: [PATCH] Show selection statistics with full double precision The Sum, Average, Min and Max values shown in the status bar of the Browse Data tab were formatted with QString::arg(double), which only uses 6 significant digits. Larger values were therefore rounded, e.g. 1234567.89 was shown as 1.23457e+06. Format them with 15 significant digits instead, which shows doubles accurately without exposing binary rounding noise. Fixes #4033 --- src/TableBrowser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/TableBrowser.cpp b/src/TableBrowser.cpp index 6a5c73f5e8..7acd40d931 100644 --- a/src/TableBrowser.cpp +++ b/src/TableBrowser.cpp @@ -561,7 +561,10 @@ void TableBrowser::refresh() min = std::min(min, dblData); max = std::max(max, dblData); } - statusMessage += tr(". Sum: %1; Average: %2; Min: %3; Max: %4").arg(sum).arg(sum/sel.count()).arg(min).arg(max); + // QString::arg(double) defaults to 6 significant digits, which silently rounds larger sums. + // Use enough precision to show doubles accurately without exposing binary rounding noise. + const auto fmt = [](double value) { return QString::number(value, 'g', 15); }; + statusMessage += tr(". Sum: %1; Average: %2; Min: %3; Max: %4").arg(fmt(sum), fmt(sum/sel.count()), fmt(min), fmt(max)); } } emit statusMessageRequested(statusMessage);