From d96ce5eb0d204289754b2c3aefd2a36fde7f49ba Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 17 Sep 2024 09:04:32 +0200 Subject: [PATCH] qlocale_tools_p.h: fix -Wfloat-equal Compilers _do_ grumble, after all: qlocale_tools_p.h:68:14: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] return d == 0; // Amusingly, compilers do not grumble. ~ ^ ~ Fix by using the public qIsNull(double) function, which has suppressions and was designed for this task. Amends f645bb8880df3cb7c9e51e6c3398485292926a3c. Pick-to: 6.7 6.5 Task-number: QTBUG-126219 Change-Id: I33f1fcb4c8c2ee30ad9a36cb46b806ef253e8062 Reviewed-by: Edward Welbourne (cherry picked from commit aac83724013a1f226d2bf4b923447eb1b0e5c493) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qlocale_tools_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qlocale_tools_p.h b/src/corelib/text/qlocale_tools_p.h index 2cfe25d2997..f862c3e312d 100644 --- a/src/corelib/text/qlocale_tools_p.h +++ b/src/corelib/text/qlocale_tools_p.h @@ -65,7 +65,7 @@ void qt_doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, [[nodiscard]] constexpr inline bool isZero(double d) { - return d == 0; // Amusingly, compilers do not grumble. + return qIsNull(d); } // Enough space for the digits before the decimal separator: