Double.IsInfinity(Double) Double.IsInfinity(Double) Double.IsInfinity(Double) Double.IsInfinity(Double) Method

定义

返回一个值,该值指示指定数字是计算为负无穷大还是正无穷大。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 Double Double Double

一个双精度浮点数。A double-precision floating-point number.

返回

如果 d 的计算结果为 PositiveInfinityNegativeInfinity,则为 true;否则为 falsetrue if d evaluates to PositiveInfinity or NegativeInfinity; otherwise, false.

示例

下面的代码示例阐释了的IsInfinity用法:The 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.

适用于

另请参阅