Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to control big numbers in QML like (-715827883)
Forum Update on Monday, May 27th 2025

How to control big numbers in QML like (-715827883)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 336 Views
  • 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.
  • S Offline
    S Offline
    Shubham Gupta
    wrote on last edited by
    #1

    @dheerendra
    Hi

    I have a variable like val=1
    I have applied certain condition.
    When the condition is true then val is multiplied by 3.
    like 3, 9, 27, 81, 243..........
    but after a long loop it shows like -715827883 value.
    Why?

    I want my result like,

    When i start to execute my loop revesely
    then val/3 is executed and at the end it will give 1.
    But now its giving 0.

    Please suggest.

    Shubham Gupta

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Variables in your computer have a limit - if you go over that limit, the value overflows, and the CPU will think that it is the at the lowest limit, instead of the highest.

      This is not a QML thing, this is not a C++ thing - that is how computers work. You can read more about this here: https://en.wikipedia.org/wiki/Integer_overflow

      To prevent that situation from happening, you should guard your arithmetic operation - check if result does not exceed INT_MAX in C (more info).

      (Z(:^

      1 Reply Last reply
      3

      • Login

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