NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a TestStand bug when converting 4294967295 to binary?

Solved!
Go to solution

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?

 

NumericFormatBinary.JPGNumericFormatHex.JPG

0 Kudos
Message 1 of 3
(4,481 Views)
Solution
Accepted by topic author skribling

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

Message 2 of 3
(4,455 Views)
I just verified that this works fine in TestStand 4.2.
0 Kudos
Message 3 of 3
(4,410 Views)