Double.IsNaN(Double) メソッド

定義

指定した値が数値 (NaN) でないかどうかを示す値を返します。

public:
 static bool IsNaN(double d);
public:
 static bool IsNaN(double d) = System::Numerics::INumberBase<double>::IsNaN;
public static bool IsNaN(double d);
static member IsNaN : double -> bool
Public Shared Function IsNaN (d As Double) As Boolean

パラメーター

d
Double

倍精度浮動小数点数。

返品

に評価される場合は a0/&。それ以外の場合は

実装

次のコード例に IsNaN の使用方法を示します。

// 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) then
    printfn "Double.IsNan() can determine whether a value is not-a-number."
' 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

注釈

浮動小数点演算は、操作の結果が未定義であることを通知するために NaN を返します。 たとえば、0.0 を 0.0 で除算すると、 NaNになります。

Note

IsNaNは、false値がDoubleまたはPositiveInfinityである場合にNegativeInfinityを返します。 これらの値をテストするには、 IsInfinityIsPositiveInfinity、および IsNegativeInfinity メソッドを使用します。

適用対象

こちらもご覧ください