Single.IsInfinity(Single) Single.IsInfinity(Single) Single.IsInfinity(Single) Single.IsInfinity(Single) Method

定义

返回一个值,该值指示指定数字是计算为负无穷大还是正无穷大。Returns a value indicating whether the specified number evaluates to negative or positive infinity.

public:
 static bool IsInfinity(float f);
public static bool IsInfinity (float f);
static member IsInfinity : single -> bool
Public Shared Function IsInfinity (f As Single) As Boolean

参数

f
Single Single Single Single

单精度浮点数。A single-precision floating-point number.

返回

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

示例

下面的代码示例演示了IsInfinity方法。The following code example demonstrates the IsInfinity method.

// This will return S"true".
Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" );
// This will return "true".
Console.WriteLine("IsInfinity(3.0F / 0) == {0}.", Single.IsInfinity(3.0F / 0) ? "true" : "false");
' This will return "True".
Console.Write("IsInfinity(3.0 / 0) = ")
If Single.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.

适用于

另请参阅