A quiet NaN (“not a number”).
- Xcode 8.0+
- Swift Standard Library
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.
Because a NaN always compares not equal to itself, to test whether a floating-point value is NaN, use its
is property instead of the equal-to operator (
==). In the following example,
y is NaN.