csharp
using System;
public class Test
{
public static void Main()
{
double b=1.1;
double c=double.NaN;
Console.WriteLine("b="+b);
Console.WriteLine("c="+c);
Console.WriteLine("b==double.NaN: "+(b==double.NaN));
Console.WriteLine("double.IsNaN(b): "+double.IsNaN(b));
Console.WriteLine("c==double.NaN: "+(c==double.NaN));
Console.WriteLine("double.IsNaN(c): "+double.IsNaN(c));
}
}
运行结果:
b=1.1
c=NaN
b==double.NaN: False
double.IsNaN(b): False
c==double.NaN: False
double.IsNaN( c): True