[Qt-interest] Is the bug for QtScript when deal the ULongLong num?

Rohan McGovern rohan.mcgovern at nokia.com
Tue Jun 8 05:15:53 CEST 2010


On Tuesday 08 June 2010, ext lvbing lvbing wrote:
> Hi all:

Hi,

> My Platform is WinXp + Qt4.5.3 + VS2008.
> I find an error when the QtScriptEngine evaluate the QtScript
> like this:
>
> id = 10696049421123587;
> slotHandle.DealULongLong(id);
>
> at first I want the parameter id in the slot function
> DealULongLong is also the value 10696049421123587. But the result
> is not I want.
>

>
>
> so is the bug in QtScript when deal the ULongLong number?
>

In ECMAscript, there is only one Number type, and that is IEEE 754 
double.  That means that not all integer values can be represented 
accurately as a Number in ECMAscript - meaning that if you pass 
integers to and from a QScriptEngine you may lose precision.

I suspect this is the problem you've hit, though I didn't do the 
maths for your specific number.

-- 
Rohan



More information about the Qt-interest-old mailing list