C# Single IsNaN
Description
Single IsNaN
returns a value that indicates whether the
specified value is not a number (NaN).
Syntax
Single.IsNaN
has the following syntax.
public static bool IsNaN(
float f
)
Parameters
Single.IsNaN
has the following parameters.
f
- A single-precision floating-point number.
Returns
Single.IsNaN
method returns true if f evaluates to not a number (NaN); otherwise, false.
Example
The following code example demonstrates the IsNaN method.
/*from w w w. j a v a 2 s . c o m*/
using System;
public class MainClass
{
public static void Main(String[] argv)
{
float zero = 0.0F;
// This will return true.
if (Single.IsNaN(0 / zero))
{
Console.WriteLine("Single.IsNan() can determine whether a value is not-a-number.");
}
}
}
The code above generates the following result.