Szerkesztés

Megosztás a következőn keresztül:


Single.IsInfinity(Single) Method

Definition

Returns a value indicating whether the specified number evaluates to negative or positive infinity.

public:
 static bool IsInfinity(float f);
public:
 static bool IsInfinity(float f) = System::Numerics::INumberBase<float>::IsInfinity;
public static bool IsInfinity (float f);
static member IsInfinity : single -> bool
Public Shared Function IsInfinity (f As Single) As Boolean

Parameters

f
Single

A single-precision floating-point number.

Returns

true if f evaluates to PositiveInfinity or NegativeInfinity; otherwise, false.

Implements

Examples

The following code example demonstrates the IsInfinity method.

// This will return S"true".
Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" );
// This will return "true".
Console.WriteLine("IsInfinity(3.0F / 0) == {0}.", Single.IsInfinity(3.0F / 0) ? "true" : "false");
// This will return "true".
printfn $"IsInfinity(3.0F / 0) == %b{Single.IsInfinity(3f / 0f)}."
' This will return "True".
Console.Write("IsInfinity(3.0 / 0) = ")
If Single.IsPositiveInfinity(3 / 0) Then
    Console.WriteLine("True.")
Else
    Console.WriteLine("False.")
End If

Remarks

Floating-point operations return PositiveInfinity or NegativeInfinity to signal an overflow condition.

Applies to

See also