Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Single.IsNaN Method

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

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

public static bool IsNaN(
	float f
)

Parameters

f
Type: System.Single
A single-precision floating-point number.

Return Value

Type: System.Boolean
true if f evaluates to not a number (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 code example demonstrates the IsNaN method.


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


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft