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

배정밀도 부동 소수점 숫자입니다.

반환

dNaN으로 계산되면 true이고, 그렇지 않으면 false입니다.

구현

예제

다음 코드 예제에서는 의 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))
   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.

참고

IsNaNPositiveInfinity 이 또는 NegativeInfinityDouble 면 를 반환 false 합니다. 이러한 값을 테스트하려면 , IsPositiveInfinityIsNegativeInfinity 메서드를 IsInfinity사용합니다.

적용 대상

추가 정보