LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with VI - unidentified cause - possible race condition.

James,

 

The quotient would be 1 if they are equal.

 

This has the same problem.  The best algorithm is to take the absolute value of the difference between the numbers and ask if that is less than some small number.  Recent versions of LV have a built in constant on the Numeric palette called Machine Epsilon ~ 2E-16.  This is the smallest number which when added to 1 gives a result which is different from 1 for double precision numbers.  It may vary with OS and computer hardware.  In many practical cases you may want to use a number larger than that, particularly if the numbers you are comparing are the result of a chain of calculations where the finite representation error may have been accentuated by the processes.

 

Here is a VI (LV8.2) I wrote some time back to deal with this issue.  This tests for equal to zero +/- .000001.  It could be modified to test for equality of two doubles.

 

Lynn 

0 Kudos
Message 21 of 21
(341 Views)