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 以指示溢出条件。