summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qfloat16.h2
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index e574ffed78..c2e5379eb4 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -239,7 +239,7 @@ Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length
*/
[[nodiscard]] inline bool qFuzzyIsNull(qfloat16 f) noexcept
{
- return qAbs(static_cast<float>(f)) <= 0.001f;
+ return qAbs(f) < 0.00976f; // 1/102.5 to 3 significant digits; see qFuzzyCompare()
}
[[nodiscard]] inline bool qIsNull(qfloat16 f) noexcept
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
index 71a05d3031..35d7dbccf0 100644
--- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
+++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
@@ -118,7 +118,7 @@ void tst_qfloat16::fuzzyIsNull_data()
QTest::addColumn<qfloat16>("value");
QTest::addColumn<bool>("isNull");
using Bounds = std::numeric_limits<qfloat16>;
- const qfloat16 one(1), huge(1000), tiny(0.00099f);
+ const qfloat16 one(1), huge(1000), tiny(0.00976f);
QTest::newRow("zero") << qfloat16(0.0f) << true;
QTest::newRow("min") << Bounds::min() << true;