Check out example codes for "check if nan swift". It will help you in understanding the concepts better.

Code Example 1

let x = 0.0
let y = x * .infinity
// y is a NaN

// Comparing with the equal-to operator never returns 'true'
print(x == Double.nan)
// Prints "false"
print(y == Double.nan)
// Prints "false"

// Test with the 'isNaN' property instead
// Prints "false"
// Prints "true"

Learn ReactJs, React Native from