Functions > Data Analysis > Outliers and NaN > About the NaN (Not a Number) Built-In Constant
About the NaN (Not a Number) Built-In Constant
The built-in PTC Mathcad constant NaN represents a missing or faulted value. It is useful for representing missing values in data sets, because it can be an array entry that you can easily distinguish from other matrix contents. It is also useful because PTC Mathcad matrices cannot have empty placeholders. The constant undefined represents missing values in symbolic calculations.
NaN and undefined
The numeric value of NaN is NaN. In other words, if you type NaN= in a worksheet, PTC Mathcad returns NaN and assigns it the Constant label.
When you evaluate NaN symbolically, the result is the undefined constant.
The numeric value of undefined is NaN. In other words, if you type undefined= in a worksheet, PTC Mathcad returns NaN and assigns it the Constant label.
Although very similar, you can see the difference between NaN and undefined when comparing them symbolically and numerically.
PTC Mathcad handles calculations that involve NaN and undefined to return the correct result. For example:
NaN Related Functions
You detect NaNs using the IsNaN function, because boolean comparison operations can only be used on numbers. If you redefine the constant name NaN to some other value, it is no longer a NaN, and the IsNaN function returns 0. A NaN can only be processed by functions specifically written to use it. Other functions may return errors or incorrect results if passed a NaN.
The NaN-related functions:
Work exclusively with the NaN built-in constant.
Write the NaN built-in constant to one or more specified array elements. Otherwise, the functions read one or more specified array elements and check their content for the NaN constant.
Can filter out specified rows that contain the NaN constant.
Ignore anything that is not a NaN constant — such as numbers or strings.
Was this helpful?