LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NaN bug : If A=NaN, and B=NaN, then A==B right? Not according to LV.

Solved!
Go to solution

I'm trying to write some code that finds NaN's in a 1D array of doubles, but for some reason, the "equals" and "not equals" checks are not working properly.  I'm using LabVIEW 2009, but this bug might be present in earlier versions.

 

See the attached screenshot and code. 

 

When will this get fixed?  How else can I filter out NaN's from a 1D array?  Is there a "NaN" constant that I can use instead of just typing the text "NaN" into a constant of type double?

Download All
0 Kudos
Message 1 of 4
(3,841 Views)
This makes sense. NaN could mean any number of things.
PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 2 of 4
(3,832 Views)
Solution
Accepted by topic author RichardBallantyne

This is not a bug. Any comparison involving NaN results in a FALSE for good reason.

 

To check for NaN, use this primitive.

Message 3 of 4
(3,830 Views)
Thanks for the solution!
0 Kudos
Message 4 of 4
(3,821 Views)