# NaN

## Purpose

Not-a-Number.

## Synopsis

    NaN

## Description

`NaN` is the IEEE arithmetic representation for Not-a-Number (NaN). `NaN`s result from operations which have undefined numerical results.

## Examples

The following operations produce `NaN`:

- Any arithmetic operation on a `NaN`, such as `sqrt(NaN)`
- Addition or subtraction, such as magnitude subtraction of infinities as `(+Inf)+(-Inf)`
- Multiplication, such as `0`*`Inf`
- Division, such as `0/0` and `Inf/Inf`
- Remainder, such as `rem(x,y)` where `y` is zero or `x` is infinity
- Comparison by way of predicates involving < or >, such as `min([Inf NaN])` and `max([Inf NaN])`
  Logical operations involving `NaN`s always return false, except ~= (not equal). Consequently, the statement `NaN` ~= `NaN` is true while the statement `NaN` == `NaN` is false.

  ## See Also

      dbstop, finite, Inf, isinf, isnan

  (c) Copyright 1994 by The MathWorks, Inc.