Explicit value cast from double to uint

mbowdich
Posts: 209
Joined: Tue Oct 05, 2010 10:54 am

Explicit value cast from double to uint

Post by mbowdich » Thu Aug 25, 2011 8:55 pm

I am having a problem every time I try to convert a double into a uint. For example I have the number 4294967294 (0xFFFFFFFE) stored in a database variable. I can read it into the script as a double and write it back out to the database with no problem.

However, if I implicitly or explicitly convert it to a uint, the number becomes 2147483647 (0x7FFFFFFF), even though the real value is within the valid range for a uint.

To overcome the issue, I can cast 2 times as below:

Code: Select all

// dTestVar is the double read in from the database

uint uTestVar = uint(uint64(dTestVar))
jtabb
Enovation Controls Development
Enovation Controls Development
Posts: 37
Joined: Mon Apr 04, 2011 8:59 am

Re: Explicit value cast from double to uint

Post by jtabb » Fri Aug 26, 2011 9:01 am

mbowdich,

I've added this to our bug tracking system. This may be a limitation within angelscript. We will get back to you soon.
jtabb
FW Murphy Development Team