Single.IsNaN(Single) Método

Definição

Retorna um valor que indica se o valor especificado não é um número (NaN).Returns a value that indicates whether the specified value is not a number (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

Um número de ponto flutuante de precisão simples.A single-precision floating-point number.

Retornos

Boolean

true se f não for avaliado como um número (NaN); caso contrário, false.true if f evaluates to not a number (NaN); otherwise, false.

Exemplos

O exemplo de código a seguir demonstra o IsNaN método.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

Comentários

As operações de ponto flutuante retornam NaN para sinalizar que o resultado da operação é indefinido.Floating-point operations return NaN to signal that result of the operation is undefined. Por exemplo, a divisão 0,0 por 0,0 resulta em NaN .For example, dividing 0.0 by 0.0 results in NaN.

Observação

IsNaN retorna false se um Single valor for PositiveInfinity ou NegativeInfinity .IsNaN returns false if a Single value is either PositiveInfinity or NegativeInfinity. Para testar esses valores, use os IsInfinity métodos, IsPositiveInfinity e IsNegativeInfinity .To test for these values, use the IsInfinity, IsPositiveInfinity, and IsNegativeInfinity methods.

Aplica-se a

Confira também