A method or operator returns double.NaN when the result of an operation is undefined. For example, the result of dividing zero by zero is double.NaN, as the following example shows. (But note that dividing a non-zero number by zero returns either double.PositiveInfinity or double.NegativeInfinity, depending on the sign of the divisor.)
code reference: System.Double.NaN#1
code reference: System.Double.NaN#2
Use the double.IsNaN(double) method to determine whether a value is not a number. Two double.NaN values are considered unequal to one another. Therefore, it is not possible to determine whether a value is not a number by using the equality operator to compare it to another value that is equal to NaN. The comparison returns false, as the following example shows.
code reference: System.Double.NaN#3