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

QTextStream::setRealNumberPrecision sets number of digits, not fraction digits

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 6.4.3, 6.5.0, 6.6
    • 5.15.2, 6.4.1
    • Core: I/O
    • None
    • Windows
    • fe4cc2793f80e285be66c36bc1ec6903ddcd312e (dev) a505baf4a5278d843471ce058612c98ab6afa26e (6.5) 8d7227460f1c44d1faa92b853c7ce6bfbb5c37dd (6.4)

    Description

      https://doc.qt.io/qt-6/qtextstream.html#setRealNumberPrecision

      "Sets the precision of real numbers to precision. This value describes the number of fraction digits QTextStream should write when generating real numbers."

      However, it appears to set the number of digits, rather than fraction digits (which should be the number of digits after the decimal place).

      E.g:

              QTextStream out(&file);
              out.setRealNumberPrecision(6);
              double f = 12.34567890;
              out << f;

      Outputs 12.3457, not 12.345679.

       

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            srcejon Jon Beniston
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes