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

QScriptEngine fails with integer numbers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.11.1
    • 5.11.0 RC2
    • Qt Script
    • None

    Description

      QScriptEngine is truncating any integer number in the range [-2^31, 2^31) to zero. Floating point numbers and integers outside this range are not affected. This behavior is not present in 5.10.1. Attached is a simple program that exhibits the problem, giving the following output:

      "100" = 0
      "100.00001" = 100.00001
      "99.5+0.5" = 0
      "99.49999999999999+0.5" = 99.999999999999986
      "99.49999999999999+0.50000000000001" = 0
      "200/2" = 0
      "50*2" = 0
      "26.8/13.4*50" = 0
      "1" = 0
      "2147483648" = 2147483648
      "2147483647" = 0
      "-2147483648" = 0
      "-2147483649" = -2147483649
      "73786976294838206464" = 7.3786976294838206e+19
      "4000000000-2000000000" = 0
      "2000000000+2000000000" = 4000000000
      "2147483647.000001" = 2147483647.000001
      "(function() { return 10; })()" = 0
      "(function() { return 10.1; })()" = 10.1
      "var x = 10; x" = 0
      "var x = 10.1; x" = 10.1

      Attachments

        1. qtbug68367.zip
          1 kB
          Friedemann Kleint
        2. repro.cpp
          1 kB
          Gabriel Souza Franco
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            gbs Gabriel Souza Franco
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes