isnan
This page explains how to use the isnan function in APL.
Use the isnan function in APL to check whether a numeric value is NaN (Not a Number). The function returns true when the value is NaN and false for all finite values and infinities.
isnan is essential for data quality work. Operations such as log of a negative number, sqrt of a negative number, or 0 / 0 produce NaN in APL. Use isnan to detect and filter these invalid values before aggregating, charting, or alerting on your data.
Usage
Syntax
APL
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | real | Yes | The numeric value to check. |
Returns
true if x is NaN. false for finite values and infinity.
List of related functions
- isfinite: Returns
truefor values that are neither infinite nor NaN. Use it for a combined check covering all invalid float states. - isinf: Returns
trueonly for infinite values. Use it alongsideisnanto cover all edge cases. - isint: Returns
truefor integer values. Use it for whole-number validation rather than float validity. - log: Returns the natural logarithm. Use
isnanto catch NaN results whenlogis applied to non-positive values. - sqrt: Returns the square root. Use
isnanto detect NaN results fromsqrton negative inputs.