Редагувати

Поділитися через


Single.IsPositiveInfinity(Single) Method

Definition

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

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

Parameters

f
Single

A single-precision floating-point number.

Returns

true if f evaluates to PositiveInfinity; otherwise, false.

Implements

Examples

The following code example demonstrates the IsPositiveInfinity method.

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

Remarks

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

Applies to

See also