Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Missing zero in exponential format

Missing zero in exponential format

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EMStegehuis
    wrote on last edited by
    #1

    Since our upgrade from qt 5.3.1 to 5.7.0 it seems that the output of the exponential format is missing the leading zero:

    Using the code below:
    double testValue = 1234.5678;
    QString (" <Value>%1</value>\n").arg (testValue, 0, 'E', 2);

    I expect:
    <Value>1.23E+03</value>
    but get:
    <Value>1.23E+3</value>

    Has anyone a clue how this could be solved?

    Regards,

    Marcel

    JKSHJ 1 Reply Last reply
    0
    • E EMStegehuis

      Since our upgrade from qt 5.3.1 to 5.7.0 it seems that the output of the exponential format is missing the leading zero:

      Using the code below:
      double testValue = 1234.5678;
      QString (" <Value>%1</value>\n").arg (testValue, 0, 'E', 2);

      I expect:
      <Value>1.23E+03</value>
      but get:
      <Value>1.23E+3</value>

      Has anyone a clue how this could be solved?

      Regards,

      Marcel

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      @EMStegehuis said in Missing zero in exponential format:

      Since our upgrade from qt 5.3.1 to 5.7.0 it seems that the output of the exponential format is missing the leading zero:

      Using the code below:
      double testValue = 1234.5678;
      QString (" <Value>%1</value>\n").arg (testValue, 0, 'E', 2);

      I expect:
      <Value>1.23E+03</value>
      but get:
      <Value>1.23E+3</value>

      Has anyone a clue how this could be solved?

      I can reproduce this.

      • Qt 5.4.2 (MSVC2013 32-bit) produces "<Value>1.23E+03</value>"
      • Qt 5.8.0 (MinGW 5.3.0) produces "<Value>1.23E+3</value>"

      It looks like the behaviour has changed between versions. I'm not sure if this was intentional or not.

      Would you be willing to raise this at the Interest mailing list? (http://lists.qt-project.org/mailman/listinfo/interest ) -- subscribe and then post there. Qt's engineers are active on that list.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      3
      • E Offline
        E Offline
        EMStegehuis
        wrote on last edited by
        #3

        Thiago Macieira responded to the request on the mailing list. It most likely has its origin in a change to using the double conversion library as of QT 5.7 over sprintf.

        See: http://lists.qt-project.org/pipermail/interest/2017-March/026409.html

        Thanks for the responses.

        Marcel

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved