Double.IsNaN Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a value indicating whether the specified number evaluates to a value that is not a number (NaN).

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)


<SecuritySafeCriticalAttribute> _
Public Shared Function IsNaN ( _
    d As Double _
) As Boolean
public static bool IsNaN(
    double d


  • d
    Type: System.Double
    A double-precision floating-point number.

Return Value

Type: System.Boolean
true if d evaluates to NaN; otherwise, false.


Floating-point operations return NaN to signal that that result of the operation is undefined. For example, dividing 0.0 by 0.0 results in NaN.


The following example illustrates the use of IsNaN:

' This will return true.
If Double.IsNaN(0 / zero) Then
   outputBlock.Text &= "Double.IsNan() can determine whether a value is not-a-number." & vbCrLf
End If
// This will return true.
if (Double.IsNaN(0 / zero))
   outputBlock.Text += "Double.IsNan() can determine whether a value is not-a-number." + "\n";

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.