Double.IsNaN 方法
返回一个值,该值指示指定数字的计算结果是否为不是数字 (NaN) 的值。
**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Shared Function IsNaN ( _
d As Double _
) As Boolean
用法
Dim d As Double
Dim returnValue As Boolean
returnValue = Double.IsNaN(d)
public static bool IsNaN (
double d
)
public:
static bool IsNaN (
double d
)
public static boolean IsNaN (
double d
)
public static function IsNaN (
d : double
) : boolean
参数
- d
一个双精度浮点数字。
返回值
如果 d 的计算结果为 NaN,则为 true;否则为 false。
备注
浮点运算返回 NaN,以发出信号表示运算结果尚未定义。例如,将 0.0 除以 0.0 会得到 NaN。
示例
下面的代码示例演示 IsNaN 的用法:
' This will return true.
If Double.IsNaN(0 / zero) Then
Console.WriteLine("Double.IsNan() can determine whether a value is not-a-number.")
End If
// This will return true.
if (Double.IsNaN(0 / zero))
{
Console.WriteLine("Double.IsNan() can determine whether a value is not-a-number.");
}
// This will return true.
if ( Double::IsNaN( 0 / zero ) )
{
Console::WriteLine( "Double::IsNan() can determine whether a value is not-a-number." );
}
// This will return true.
if (System.Double.IsNaN(0 / zero.doubleValue())) {
Console.WriteLine("Double.IsNan() can determine whether"
+ " a value is not-a-number.");
}
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0