ANYNAN

Purpose:

Returns 1 if the input or any element of the input is NaN.

Syntax:

ANYNAN(val)

val

-

Any value.

Returns:

An integer, 1 if the input or any element of the input contains at least one NaN, else 0.

Example:

a = {3, 6, 9, 12, 15, 18};

b = {3, 6, 9, 12, nan, nan, 18};

c = 5;

d = "test";

 

W1: {anynan(a)}

W2: {anynan(b)}

W3: {anynan(c)}

W4: {anynan(d)}

 

W1 == 0

W2 == 1

W3 == 0

W4 == 0

 

Variable a is a series with no NaN.

Variable b is a series that contains NaNs.

Variable c is a scalar that is not NaN.

Variable d is a string.

Example:

W1: ravel(1..9, 3);table

W2: W1;W0[.., 2] = nan

 

a = anynan(w1);

b = anynan(w2);

 

a == 0

b == 1

 

W1 contains a 3x3 array with no NaN values.

 

W2 contains a 3x3 array where the middle column is all NaN values.

 

Variable a is 0 indicating the array has no NaNs.

Variable b is 1 indicating the array contains NaNs. Even though W2 has 3 NaN values, b is the integer 1 indicating that at least one NaN value is present.

Remarks:

ANYNAN performs a fast check of the input for NaN values.

 

Use NAN or NAVALUE to create an NaN value.

See Also:

ISINF

ISNAN

ISNAVALUE

NAFILL

NAN

NAVALUE

REMOVENA

SETNAVALUE