Double.IsNaN(Double) Metodo

Definizione

Restituisce un valore che indica se il valore specificato non è un numero (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

Parametri

d
Double

Numero a virgola mobile e precisione doppia.

Valori restituiti

true se d restituisce NaN; in caso contrario, false.

Implementazioni

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di 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

Commenti

Le operazioni a virgola mobile restituiscono NaN un segnale che il risultato dell'operazione non è definito. Ad esempio, dividendo 0,0 per 0,0 restituisce NaN.

Note

IsNaN restituisce false se un Double valore è PositiveInfinity o NegativeInfinity. Per testare questi valori, usare i IsInfinitymetodi , IsPositiveInfinitye IsNegativeInfinity .

Si applica a

Vedi anche