Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QML Number() produces wrong output
Forum Updated to NodeBB v4.3 + New Features

QML Number() produces wrong output

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 4.2k 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.
  • C Offline
    C Offline
    cladden
    wrote on last edited by
    #1

    How do I make toFixed() display all 4 decimal places on Windows CE, similar to the desktop?

    The code:
    @text: level.toFixed(4)@

    Win CE - not showing decimal places:
    !http://i.troll.ws/14f21476.jpg!

    Win 32 - desktop shows all four places:
    !http://i.troll.ws/0427b4e9.jpg!

    Thanks in advance,

    Chris

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cladden
      wrote on last edited by
      #2

      Looks like some rounding and special notation.

      What causes 64.8874 to displayed as 65.//-4?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tzander
        wrote on last edited by
        #3

        that toFixed() is as far as I know part of the Javascript engine that QML runs on top of, if its indeed doing this wrong, try getting the latest version of Qt or reporting a bug if you are indeed running the latest already.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cladden
          wrote on last edited by
          #4

          I'm using 4.8.4 and it seems all doubles are oddly formatted when displayed in QML.

          The format seems intentional, almost like a scientific notation format?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cladden
            wrote on last edited by
            #5

            QML Number("0.117") produces

            "0.0;7"

            Not a typo, the number converts wrong and there is a semicolon in the output.

            Perhaps an issue with ARM floating point?

            Does anyone else see this issue?

            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