A method or operator returns float.NaN when the result of an operation is undefined. For example, the result of dividing zero by zero is float.NaN, as the following example shows. (But note that dividing a non-zero number by zero returns either float.PositiveInfinity or float.NegativeInfinity, depending on the sign of the divisor.)
code reference: System.Single.NaN#1
code reference: System.Single.NaN#2
Use the float.IsNaN(float) method to determine whether a value is not a number. Two float.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.Single.NaN#3