LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Array Max & Min" returns 0 when array with single element NaN is entered.

Does anyone know why when I send an array with a single element NaN to "Array Max & Min" I get back 0 for both Max and Min? When I send NaN to both terminals of "Max & Min" I get back NaN for both Max and Min. This is what I was expecting from the Array function.
 
(I'm using LV 8.0.1)
 
Thoughts?
 
Thank you.
Message 1 of 4
(3,172 Views)

I don't know exactly why the function behaves that way, but here is a quick addition that can give you the behavior similar to the Min & Max function.

Cheers,

Message Edited by Spex on 03-22-2007 10:22 AM

Spex
National Instruments

To the pessimist, the glass is half empty; to the optimist, the glass is half full; to the engineer, the glass is twice as big as it needs to be has a 2x safety factor...
Message 2 of 4
(3,155 Views)
If you ask which is higher, X or NaN, then it's impossible to say, bacause NaN is "Not a Number".

Conversely, if you ask which is lower, it's just as impossible to say.

As such there is NO defined max or min of a valid number X and NaN.

That said, I don't know if there's an IEEE derictive on how to handle these cases.  In general LV matches IEEE conventions, even if I don't know off the top of my head which ones they are.....

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 3 of 4
(3,144 Views)

You should filter out nan before doing max min.  It does not make sense sincs nan usually indicates an error or invalid value.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 4
(3,132 Views)