C# Double IsNaN
Description
Double IsNaN
returns a value that indicates whether the
specified value is not a number (NaN).
Syntax
Double.IsNaN
has the following syntax.
public static bool IsNaN(
double d
)
Parameters
Double.IsNaN
has the following parameters.
d
- A double-precision floating-point number.
Returns
Double.IsNaN
method returns true if d evaluates to NaN; otherwise, false.
Example
The following code example illustrates the use of IsNaN: Double.IsNan() can determine whether a value is not-a-number.
using System;//w w w. j a v a 2 s .com
public class MainClass{
public static void Main(String[] argv){
// This will return true.
int zero = 0;
if (Double.IsNaN(0 / zero))
Console.WriteLine("true");
}
}
The code above generates the following result.