Single.IsPositiveInfinity(Single) 方法

定义

返回一个值,通过该值指示指定数字是否计算为正无穷大。

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

参数

f
Single

单精度浮点数。

返回

如果 f 的计算结果为 PositiveInfinity,则为 true;否则为 false

实现

示例

下面的代码示例演示 IsPositiveInfinity 了 方法。

// 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.
printfn $"IsPositiveInfinity(4.0F / 0) == {Single.IsPositiveInfinity(4f / 0f)}."
' 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 以发出溢出条件的信号。

适用于

另请参阅