Single.IsNaN(Single) Método

Definición

Devuelve un valor que indica si el valor especificado no es un número (NaN).

public:
 static bool IsNaN(float f);
public static bool IsNaN(float f);
static member IsNaN : single -> bool
Public Shared Function IsNaN (f As Single) As Boolean

Parámetros

f
Single

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

Devoluciones

true es si f se evalúa como no un número (NaN); de lo contrario, falsees .

Ejemplos

En el ejemplo de código siguiente se muestra el IsNaN método .

// This will return true.
if (Single.IsNaN(0 / zero))
{
    Console.WriteLine("Single.IsNan() can determine whether a value is not-a-number.");
}
// This will return true.
if Single.IsNaN(0f / zero) then
    printfn "Single.IsNan() can determine whether a value is not-a-number."
' This will return true.
If Single.IsNaN(0 / zero) Then
    Console.WriteLine("Single.IsNan() can determine whether a value is not-a-number.")
End If

Comentarios

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

Note

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

Se aplica a

Consulte también