Single.IsNegativeInfinity(Single) 方法

定义

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

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

参数

f
Single

单精度浮点数。

返回

Boolean

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

实现

示例

下面的代码示例演示了该方法 IsNegativeInfinity

// This will return true.
Console::WriteLine( "IsNegativeInfinity(-5.0F / 0) == {0}.", Single::IsNegativeInfinity(  -5.0F / zero ) ? (String^)"true" : "false" );
// This will return true.
Console.WriteLine("IsNegativeInfinity(-5.0F / 0) == {0}.", Single.IsNegativeInfinity(-5.0F / 0) ? "true" : "false");
// This will return true.
printfn $"IsNegativeInfinity(-5.0F / 0) == {Single.IsNegativeInfinity(-5f / 0f)}."
' This will return True.
Console.Write("IsNegativeInfinity(-5.0 / 0) = ")
If Single.IsNegativeInfinity(-5 / 0) Then
    Console.WriteLine("True.")
Else
    Console.WriteLine("False.")
End If

注解

浮点操作返回 NegativeInfinity 以指示溢出条件。

适用于

另请参阅