Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50036

QVariant ( double Inf ) fails equality test.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.5.1
    • Fix Version/s: 5.6.0
    • Component/s: Core: Other
    • Labels:
      None
    • Environment:
      Windows, Visual Studio 2013 x64.

      Description

      Normally, two double values representing infinity with the same sign should compare equal. However, when wrapped in a QVariant this fails.

      #include <limits>
      #include <QDebug>
      #include <QVariant>
      
      int main(void)
      {
          const double myInf = std::numeric_limits<double>::infinity();
          qDebug() << "Compare 1.23" << ( QVariant( 1.23 ) == QVariant( 1.23 ) );
          qDebug() << "Compare double Inf" << ( ( myInf ) == ( myInf ) );
          qDebug() << "Compare QVariant Inf" << ( QVariant( myInf ) == QVariant( myInf ) );
      }
      

      Output:
      Compare 1.23 true
      Compare double Inf true
      Compare QVariant Inf false

      The last comparion should be "true".

      This bug is a regression - in Qt5.3.2 it was fine.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            jds21 John Stark
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes