Single.IsNaN Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

Syntax

Public Shared Function IsNaN ( _
    f As Single _
) As Boolean
public static bool IsNaN(
    float f
)

Parameters

Return Value

Type: System..::.Boolean
true if f evaluates to not a number (NaN); otherwise, false.

Remarks

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.

Examples

The following code example demonstrates the IsNaN method.

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

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Single Structure

System Namespace

NaN