Double.IsNaN(Double) Método

Definición

Devuelve un valor que indica si el valor especificado no es un número (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

Parámetros

d
Double

Número de punto flotante de precisión doble.

Devoluciones

Boolean

Es true si d se evalúa en NaN; en caso contrario, es false.

Implementaciones

Ejemplos

En el ejemplo de código siguiente se muestra el uso de 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

Comentarios

Las operaciones de punto flotante devuelven NaN para indicar que el resultado de la operación no está definido. Por ejemplo, dividir 0,0 por 0,0 da como NaNresultado .

Nota:

IsNaN devuelve false si un Double valor es PositiveInfinity o NegativeInfinity. Para probar estos valores, use los IsInfinitymétodos , IsPositiveInfinityy IsNegativeInfinity .

Se aplica a

Consulte también