Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.0
-
None
-
I767e5280bd26614e8e78ae62b274eb9bc4ade385
Description
qIsNull(double/float) does some bit checking to check if a floating point number is +0.0.
That is not what is wanted in the cases where this function is used in QPointF, QSizeF, QQuaternion, QVector2D, QVector3D and QVector4D.
And in QRectF for example a correct "== 0.0" is used instead (which is also true for -0.0).
inline bool QRectF::isNull() const { return w == 0. && h == 0.; }
which results in QRecfF(0.0, 0.0, -0.0, -0.0).isNull() being true
While using qIsNull like in QPointF
inline bool QPointF::isNull() const { return qIsNull(xp) && qIsNull(yp); }
results in QPointF(-0.0, -0.0).isNull() being false
And even worse it is used in QSizeF::scale to not divide by 0.0 which fails for -0.0 of course:
So QSizeF(-0.0, -0.0).scale(QSizeF(1.0, 1.0), Qt::IgnoreAspectRatio) results in QSizeF(1, nan)
Please replace qIsNull(double/float) with "== 0.0" in QPointF, QSizeF, QQuaternion, QVector2D, QVector3D and QVector4D.
Attachments
For Gerrit Dashboard: QTBUG-7303 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
31978,8 | Do not consider sign in qIsNull. | master | qt/qtbase | Status: MERGED | +2 | 0 |