01-13-2010 11:04 AM
I have a problem with this VI.
I made it with LV 2009.
There is an auxiliary VI that I utilize to fetch a control's reference programmatically.
The test.vi (main) tries to set a numeric-digital control's increment programmatically.
With the help of "VI ctrl heap" it is possibile to do all the code in a single big event case.
If you modify "Multiplier N" --> he grabs "Value N", for N = 1, 2, 3, ... , 7
he takes the Multiplier N's value and checks if it is == 1. Then set Value N's increment accordingly.
Problem:
it doesn't work as expected.
If you probe the wire, it is all correct untill the equal verification, I cannot understand why it doesn't work.
Thanks for your advices.
Greetings
Solved! Go to Solution.
01-13-2010 11:33 AM
The problem is likely due to the equals comparison of non-integer datatypes. Since fractions like 0.1 cannot be represented exactly in binary, equals comparisons often result in numbers which appear to be equal when displayed to one decimal place are actually different in the 14th, 15th, or 16th place.
Use an approximate comparison: Is the absolute value of the difference less than 10^-14?
Lynn
01-13-2010 04:02 PM
01-14-2010 01:49 AM
Ok, you are right, I fixed it.
Explanation is here: Why does my Equal Comparison Not Work with Floating Point Numbers?