Double.IsNaN(Double) Метод
Определение
public:
static bool IsNaN(double d);
public static bool IsNaN (double d);
static member IsNaN : double -> bool
Public Shared Function IsNaN (d As Double) As Boolean
Параметры
- d
- Double
Число двойной точности с плавающей запятой.A double-precision floating-point number.
Возвращаемое значение
Значение true
, если значение параметра d
равно NaN; в противном случае — значение false
.true
if d
evaluates to NaN; otherwise, false
.
Примеры
В следующем примере кода показано использование IsNaN :The following code example illustrates the use of 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
Console.WriteLine("Double.IsNan() can determine whether a value is not-a-number.")
End If
Комментарии
Операции с плавающей запятой возвращают NaN сигнал о том, что результат операции не определен.Floating-point operations return NaN to signal that result of the operation is undefined. Например, деление 0,0 на 0,0 приводит к NaN .For example, dividing 0.0 by 0.0 results in NaN.
Примечание
IsNaN Возвращает, false
Если Double значение равно либо PositiveInfinity NegativeInfinity .IsNaN returns false
if a Double value is either PositiveInfinity or NegativeInfinity. Чтобы проверить эти значения, используйте IsInfinity IsPositiveInfinity методы, и IsNegativeInfinity .To test for these values, use the IsInfinity, IsPositiveInfinity, and IsNegativeInfinity methods.