共用方式為


Double.IsPositiveInfinity(Double) 方法

定義

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

public:
 static bool IsPositiveInfinity(double d);
public:
 static bool IsPositiveInfinity(double d) = System::Numerics::INumberBase<double>::IsPositiveInfinity;
public static bool IsPositiveInfinity (double d);
static member IsPositiveInfinity : double -> bool
Public Shared Function IsPositiveInfinity (d As Double) As Boolean

參數

d
Double

雙精確度浮點數。

傳回

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

實作

範例

下列程式碼範例說明 如何使用 IsPositiveInfinity

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

備註

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

適用於

另請參閱