---
title: nan
framework: swift
role: symbol
role_heading: Type Property
path: swift/float/nan
---

# nan

A quiet NaN (“not a number”).

## Declaration

```swift
static var nan: Float { get }
```

## Discussion

Discussion A NaN compares not equal, not greater than, and not less than every value, including itself. Passing a NaN to an operation generally results in NaN. let x = 1.21 // x > Double.nan == false // x < Double.nan == false // x == Double.nan == false Because a NaN always compares not equal to itself, to test whether a floating-point value is NaN, use its isNaN property instead of the equal-to operator (==). In the following example, y is NaN. let y = x + Double.nan print(y == Double.nan) // Prints "false" print(y.isNaN) // Prints "true"

## See Also

### Accessing Numeric Constants

- [pi](swift/float/pi.md)
- [infinity](swift/float/infinity.md)
- [greatestFiniteMagnitude](swift/float/greatestfinitemagnitude.md)
- [signalingNaN](swift/float/signalingnan.md)
- [ulpOfOne](swift/float/ulpofone.md)
- [leastNormalMagnitude](swift/float/leastnormalmagnitude.md)
- [leastNonzeroMagnitude](swift/float/leastnonzeromagnitude.md)
- [zero](swift/float/zero.md)
