Double.IsNegativeInfinity(Double) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回值,指出指定的數字是否計算結果為負的無限大。
public:
static bool IsNegativeInfinity(double d);
public:
static bool IsNegativeInfinity(double d) = System::Numerics::INumberBase<double>::IsNegativeInfinity;
public static bool IsNegativeInfinity (double d);
static member IsNegativeInfinity : double -> bool
Public Shared Function IsNegativeInfinity (d As Double) As Boolean
參數
- d
- Double
雙精確度浮點數。
傳回
如果 d
計算結果為 NegativeInfinity,則為 true
;否則為 false
。
實作
範例
下列程式碼範例說明 如何使用 IsNegativeInfinity :
// This will return S"true".
Console::WriteLine( "IsNegativeInfinity(-5.0 / 0) == {0}.", Double::IsNegativeInfinity( -5.0 / zero ) ? (String^)"true" : "false" );
// This will return "true".
Console.WriteLine("IsNegativeInfinity(-5.0 / 0) == {0}.", Double.IsNegativeInfinity(-5.0 / 0) ? "true" : "false");
// This will return "true".
printfn $"IsNegativeInfinity(-5.0 / 0) = {Double.IsNegativeInfinity(-5. / 0.)}."
' This will return "True".
Console.Write("IsNegativeInfinity(-5.0 / 0) = ")
If Double.IsNegativeInfinity(-5 / 0) Then
Console.WriteLine("True.")
Else
Console.WriteLine("False.")
End If
if ( d > Double::MaxValue )
{
Console::WriteLine( "Your number is bigger than a double." );
}
if (d > Double.MaxValue)
Console.WriteLine("Your number is bigger than a double.");
if d > Double.MaxValue then
printfn $"Your number is bigger than a double."
If D > Double.MaxValue Then
Console.WriteLine("Your number is bigger than a double.")
End If
// This will equal Infinity.
Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Double::NegativeInfinity) );
// This will equal Infinity.
Console.WriteLine("10.0 minus NegativeInfinity equals {0}.", (10.0 - Double.NegativeInfinity).ToString());
// This will equal Infinity.
printfn $"10.0 minus NegativeInfinity equals {10.0 - Double.NegativeInfinity}."
' This will equal Infinity.
Console.WriteLine("10.0 minus NegativeInfinity equals " + (10 - Double.NegativeInfinity).ToString() + ".")
備註
浮點運算會返回 NegativeInfinity 以發出溢位條件的訊號。