共用方式為


Single.IsNegativeInfinity(Single) 方法

定義

傳回值,指出指定的數字是否計算結果為負的無限大。

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

參數

f
Single

單精確度浮點數。

傳回

如果 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 以發出溢位狀況的訊號。

適用於

另請參閱