# Double.NaN Field

.NET Framework 1.1

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

```[Visual Basic]
Public Const NaN As Double
[C#]
public const double NaN;
[C++]
public: const double NaN;
[JScript]
public var NaN : double;```

#### Remarks

The value of this constant is the result of dividing zero by zero.

This constant is returned when the result of an operation is undefined.

Use IsNaN to determine whether a value is not a number. It is not possible to determine whether a value is not a number by comparing it to another value equal to NaN.

#### Example

[Visual Basic, C#, C++] The following code sample illustrates the use of NaN:

```[Visual Basic]
Dim zero As Double = 0

' This condition will return false.
If (0 / zero) = Double.NaN Then
Console.WriteLine("0 / 0 can be tested with Double.NaN.")
Else
Console.WriteLine("0 / 0 cannot be tested with Double.NaN; use Double.IsNan() instead.")
End If

[C#]
Double zero = 0;

// This condition will return false.
if ((0 / zero) == Double.NaN)
{
Console.WriteLine("0 / 0 can be tested with Double.NaN.");
}
else
{
Console.WriteLine("0 / 0 cannot be tested with Double.NaN; use Double.IsNan() instead.");
}

[C++]
Double zero = 0;

// This condition will return false.
if ((0 / zero) == Double::NaN) {
Console::WriteLine(S"0 / 0 can be tested with Double::NaN.");
} else {
Console::WriteLine(S"0 / 0 cannot be tested with Double::NaN; use Double::IsNan() instead.");
}
```

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.

#### Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard