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

QString("2553.278").toDouble() return 2553.2779999999997926

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 4.6.0
    • None
    • WindowsXP, VS2005

    Description

      #include <QtCore/QCoreApplication>

      #include <QDebug>

      int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);

      QString testString = QString("2553.278");

      bool ok = false;
      double testValue = testString.toDouble( &ok );

      qDebug() << ok << QString("%1").arg( testValue, 0, 'g', 20 );
      //as result we have had 'true 2553.2779999999997926' in the console

      return a.exec();
      }

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            kuchumov Alexander Kuchumov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes