# countNanInf {#countnaninf}

**Parent topic:**[Functions](../../Functions/category.md)

## Syntax {#syntax}

`countNanInf(X, [includeNull=false])`

## Arguments {#arguments}

**X** is a DOUBLE type scalar, vector or matrix.

**includeNull** \(optional\) is a BOOLEAN value. The default value is false.

## Details {#details}

An aggregate function that counts the number of NaN values and Inf values in *X*. When *includeNull* = true, the result includes the number of null values.

Related function: [isNanInf](../i/isNanInf.md)

