LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare two numbers

How is this possible? The attached VI shows two while loops where two numbers are compared. I don't understand why the first one gives a "TRUE" result and the second one a "FALSE" result.
0 Kudos
Message 1 of 3
(3,874 Views)
When doing multiplication or division there will be a certain amount of rounding error associated with it.  LabVIEW can sometimes hide this from you depending on the precision you ask for.  You can clearly see the difference if you add an indicator and ask for more decimal places.  This is a common CPU problem and you should manually adjust the result accordingly...
 
 
0 Kudos
Message 2 of 3
(3,863 Views)
Hmmmm...



Seems puzzling isn't it ?







You have just dicosvered the mysteries and limits of binary operations. You thought the numbers were the same, this is true using the decimal system, and false in binary.



Attached is a simple modification of your vi : It calculate the difference between the compared numbers. That's why you should never rely on an equality test when working with floating point numbers...



And of course somebody else had already given the solution...

Message Edité par chilly charly le 11-15-2005 04:50 PM

Chilly Charly    (aka CC)
0 Kudos
Message 3 of 3
(3,863 Views)