共用方式為


Single.IsPositiveInfinity(Single) 方法

定義

傳回值,指出指定數字是否計算結果為正的無限大。

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

參數

f
Single

單精確度浮點數。

傳回

如果 f 計算結果為 PositiveInfinity,則為 true;否則為 false

實作

範例

下列程式碼範例示範 IsPositiveInfinity 方法。

// 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

備註

浮點運算會返回 PositiveInfinity 以發出溢位條件的訊號。

適用於

另請參閱