Double.IsInfinity(Double) 方法

定義

傳回值,指出指定的數字是否計算結果為負或正的無限大。Returns a value indicating whether the specified number evaluates to negative or positive infinity.

public:
 static bool IsInfinity(double d);
public static bool IsInfinity (double d);
static member IsInfinity : double -> bool
Public Shared Function IsInfinity (d As Double) As Boolean

參數

d
Double

雙精確度浮點數。A double-precision floating-point number.

傳回

如果 true 計算結果為 dPositiveInfinity,則為 NegativeInfinity,否則為 falsetrue if d evaluates to PositiveInfinity or NegativeInfinity; otherwise, false.

範例

下列程式碼範例說明如何使用 IsInfinityThe following code example illustrates the use of 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".
Console.Write("IsInfinity(3.0 / 0) = ")
If Double.IsPositiveInfinity(3 / 0) Then
    Console.WriteLine("True.")
Else
    Console.WriteLine("False.")
End If

備註

浮點運算會傳回 PositiveInfinityNegativeInfinity 以發出溢位條件。Floating-point operations return PositiveInfinity or NegativeInfinity to signal an overflow condition.

適用於

另請參閱