04-29-2015 12:13 AM
I am trying to read the Numeric limit test Limit values in CVI using 'TS_PropertyGetValNumber' function. It gives with the precsion of 15.
Values returned lowLimit as 9.300000000000001 and highlimit as 10.300000000000001 instead of 9.3 and 10.3. lowLimit and HighLimit decalred as double since function''TS_PropertyGetValNumber' accepts return value as double only.
How to get the exact values which we setted in teststand?
04-29-2015 01:55 AM - edited 04-29-2015 01:58 AM
It seems to me that you are facing a known problems in storing floating point number in memory. CVI follows IEEE754 standard for Floating-point arithmetic ; this standard cannot store exactly all numbers as you are expecting, depending on how the number is stored in memory. See this link: Why is 0.1 not 0.1?
Now, I don't know exactly how TestStand is internally treating those 10.3 and 9.3 values, the value you see on video can be a rounding to 1 decimal, the same you are getting if setting this value to a numeric control in a CVI panel. I suppose you have no alternative: even performing a call to out = RoundRealToNearestInteger (9.3 * 10.0) / 10.0; gives you 9.300000000000001 as the result of the last division.