Single.IsPositiveInfinity(Single) 方法

定义

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

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

参数

f
Single

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

返回

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

示例

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

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

注解

浮点运算返回 PositiveInfinity 以指示溢出情况。Floating-point operations return PositiveInfinity to signal an overflow condition.

适用于

另请参阅