02-06-2006 12:00 AM
Hi All,
I have a vi that is supposed to determine whether a particular number multiplied by 0.2 is larger than or equal to a minimum number (indicating a pass condition). Now, to test this vi I want to know what happens when the particular number multiplied by 0.2 is EQUAL to the minimum number.
In other words...
if number=4 and minimum=4*0.2=0.8 then PASS, else FAIL
This vis works for all numbers except when number=3!!!
WHAT THE????
02-06-2006 01:00 AM
02-06-2006 01:03 AM
Hi Melanie,
I don't quite understand your explanation of what you're trying to accomplish, so I'll just explain to you what your VI is doing and you can see if that's what you're trying to do. "PASS" will be true if 'minimum' is greater than or equal to 'number' multiplied by 0.2. "FAIL" will be true if 'minimum' is less than 'number' multiplied by 0.2. Trying this VI with a number of different values, the functions always seem to do what they're supposed to.
For your particular case, why don't you create an indicator off the different wires and change its precision to show a bunch of digits, and see if a floating point roundoff error is the cause of your problem. Otherwise, attach a VI to your post with the *specific* values saved as default in the controls that you are having a problem with.
Good luck,
-D
02-06-2006 01:26 AM
02-06-2006 01:59 AM
Hi
Unfortunately this is not just math - it's representation of floating point numbers on a binary base.
You say, you checked the properties and the controls should carry 6 significant digits, but this is just for the graphical representation on the front panel. So although you may see a number of 6.400000 for instance, it's value may be 6.40000000000001. This is a topic, which was and still is discussed in the forum.
What you could do to improve your vi, is to insert some rounding (e.g. round to nearest).
Thomas
02-06-2006 05:33 AM
02-06-2006 07:40 AM
02-06-2006 07:42 AM
Wiebe:
Testing floats for equality is never a good idea, really never.
02-06-2006 08:03 PM - edited 02-06-2006 08:03 PM
Message Edited by MelanieM on 02-06-2006 08:06 PM
02-06-2006 08:18 PM