LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Teststand Limits value in CVI using Teststand API

I am trying to read the Numeric limit test Limit values in CVI using 'TS_PropertyGetValNumber' function. It gives with the precsion of 15. ScreenHunter_01 Apr. 29 10.32.gifScreenHunter_02 Apr. 29 10.33.gifScreenHunter_03 Apr. 29 10.34.gif

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? 

 

 

 

 

0 Kudos
Message 1 of 2
(4,090 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(4,075 Views)