共用方式為


Double.IsInfinity(Double) 方法

定義

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

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

參數

d
Double

雙精確度浮點數。

傳回

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

實作

範例

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

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

備註

浮點運算會傳回 PositiveInfinityNegativeInfinity 發出溢位狀況的訊號。

適用於

另請參閱