NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Max(Array) containing NaN

I was surprised to observe that Max/Min functions will ignore NaN values inside an array.


Except if the first element is NaN, in this case the function will return NaN no matter what the rest of elements are real values.


Is it the expected behavior? To me it seems like a bug.


I'm using Teststand 2014.



0 Kudos
Message 1 of 2

I think this can be expected. IEEE754 standard defines that any comparison with NaN except != returns false.  And the Max (Array) function does probably something like

Max = Array[0];

for (i= 1; i< Lenght(Array); i++)

    if (Array[i] > Max)

        Max = Array[i] ;


This will give you the observed result.



0 Kudos
Message 2 of 2