Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to show big numbers as the number NOT scientific notation?
Qt 6.12 LTS is out! See what's new in the release blog

How to show big numbers as the number NOT scientific notation?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 967 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I am using:

    qDebug() << QString("stale_data_t::stale dblDown[%1] dblEpoch[%2] dblAge[%3] strToolTip[%4]")
                    .arg(QString::number(pobjUDT->m_dblDown))
                    .arg(QString::number(pobjUDT->m_dblEpoch))
                    .arg(QString::number(dblAge))
                    .arg(strToolTip);
    

    In my application , the result is something like:

    "stale_data_t::stale dblDown[1.66963e+12] dblEpoch[1.66963e+12] dblAge[6620] strToolTip[IF down: 6.620 seconds]" ../staleData.C: 287
    

    For dblDown and dblEpoch I want to see the large number not the scientific notation, how do I do this ?

    Kind Regards,
    Sy

    O 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I relly thought you're long enough here to know where the documentation is.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      SPlattenS 1 Reply Last reply
      2
      • SPlattenS SPlatten

        I am using:

        qDebug() << QString("stale_data_t::stale dblDown[%1] dblEpoch[%2] dblAge[%3] strToolTip[%4]")
                        .arg(QString::number(pobjUDT->m_dblDown))
                        .arg(QString::number(pobjUDT->m_dblEpoch))
                        .arg(QString::number(dblAge))
                        .arg(strToolTip);
        

        In my application , the result is something like:

        "stale_data_t::stale dblDown[1.66963e+12] dblEpoch[1.66963e+12] dblAge[6620] strToolTip[IF down: 6.620 seconds]" ../staleData.C: 287
        

        For dblDown and dblEpoch I want to see the large number not the scientific notation, how do I do this ?

        O Offline
        O Offline
        ollarch
        wrote on last edited by
        #3

        @SPlatten QString::arg has a "format" parameter. Using "f" format it will not be displayed using scientific notation.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          I relly thought you're long enough here to know where the documentation is.

          SPlattenS Offline
          SPlattenS Offline
          SPlatten
          wrote on last edited by SPlatten
          #4

          @Christian-Ehrlicher , thank you, perfect:

          qDebug() << QString("stale_data_t::stale dblDown[%1] dblEpoch[%2] dblAge[%3] strToolTip[%4]")
                          .arg(QString::number(pobjUDT->m_dblDown, 'f', 0))
                          .arg(QString::number(pobjUDT->m_dblEpoch, 'f', 0))
                          .arg(QString::number(dblAge, 'f', 0))
                          .arg(strToolTip);
          

          Result:

          "stale_data_t::stale dblDown[1669632401645] dblEpoch[1669632401645] dblAge[1370] strToolTip[IF down: 1.370 seconds]" ../staleData.C: 287
          

          Kind Regards,
          Sy

          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
          • Unsolved