Single.IsNaN(Single) Metodo
Definizione
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
Parametri
- f
- Single
Numero a virgola mobile a precisione singola.A single-precision floating-point number.
Restituisce
true
se f
restituisce un valore non numerico (NaN); in caso contrario, false
.true
if f
evaluates to not a number (NaN); otherwise, false
.
Esempi
Nell'esempio di codice riportato di seguito viene illustrato il metodo IsNaN.The following code example demonstrates the IsNaN method.
// 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(0 / zero))
{
Console.WriteLine("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
Commenti
Le operazioni a virgola mobile restituiscono NaN per segnalare che il risultato dell'operazione non è definito.Floating-point operations return NaN to signal that result of the operation is undefined. Ad esempio, la divisione di 0,0 per 0,0 restituisce NaN.For example, dividing 0.0 by 0.0 results in NaN.
Nota
IsNaN restituisce false
se un valore Single è PositiveInfinity o NegativeInfinity.IsNaN returns false
if a Single value is either PositiveInfinity or NegativeInfinity. Per testare questi valori, usare i metodi IsInfinity, IsPositiveInfinitye IsNegativeInfinity.To test for these values, use the IsInfinity, IsPositiveInfinity, and IsNegativeInfinity methods.