System.Double.NaN Field

Represents a value that is not a number (NaN). This field is constant.

Value: NaN

Syntax

public const double NaN

Remarks

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

In addition, a method call with a double.NaN value or an operation on a double.NaN value returns double.NaN, as the following example shows.

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

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0