10-24-2009 12:30 PM
When a binary variable is set to 4294967295 the binary value is displayed as 0b10000000000000000000000000000000 and not 0b11111111111111111111111111111111 as it should be. (4294967295 is 0xFFFFFFFF). Octal and Hex both work fine. This can be tested using the SequenceEditor NumericFormat dialog. TestStand version 4.1. Is there a workaround?
Solved! Go to Solution.
10-26-2009 10:29 AM
This was fixed in 4.1.1.
There isn't really a workaround, although the actual stored value is still correct. The numeric format is purely for display purposes. You could write your own display code if you want, though it would probably be easier to just upgrade to 4.1.1 since you are already using 4.1.
This behavior was introduced because of a change in the compiler we use that caused casts from double to int to no longer wrap and instead result in an overflow value (the value you are seeing). The compiler is basically now using a newer processor instruction that has this behavior. This could also happen in your own C/C++ code, depending on the compiler you use, whenever you cast a double to an int (TestStand numbers are stored as doubles) so it is something to be aware of. The solution is to cast to an unsigned integer first, however you have to be careful how you do this or the compiler will optimize it out and it won't work in the release build.
Hope this helps,
-Doug
10-30-2009 01:14 PM