<div dir="ltr">Hello all,<br><br>I’m using qFuzzyCompare(a, b) in order to handle all floating point comparisons, but it has severe limitations when a or b may be zero.<br><br>Somewhere in the docs it is recommended to add +1 to the values, but this is not a really useful suggestion because some of the values might be -1.0, resulting in 0.0 after the addition.<br>
<br>So in each file which needs to perform floating point comparisons, I always end up using this or something similar to this macro:<br><br>    #include <QtGlobal> // qMax, qMin, qFuzzyCompare<br>    #define qFuzzyCompare(a, b) (qFuzzyIsNull(a) && qFuzzyIsNull(b)) || qFuzzyCompare((a), (b))<br>
<br>But instead of ad-hoc workarounds, IMHO this caveat should be fixed straight in the implementation of the qFuzzyCompare() function. A really old bug report already exists: QTBUG-16819 [<a href="http://bugreports.qt-project.org">bugreports.qt-project.org</a>] it is open but it seems that discussion ended on 2011 for some reason.<br>
<br>Could anyone add a bit more on this subject?<br></div>