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.8 6.7 6.5
Task-number: QTBUG-126219
Change-Id: I33f1fcb4c8c2ee30ad9a36cb46b806ef253e8062
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2024-09-17 09:04:32 +02:00
parent 4bf1ed8021
commit aac8372401

View File

@ -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: