Double.IsNegativeInfinity 方法

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

**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Shared Function IsNegativeInfinity ( _
    d As Double _
) As Boolean
用法
Dim d As Double
Dim returnValue As Boolean

returnValue = Double.IsNegativeInfinity(d)
public static bool IsNegativeInfinity (
    double d
)
public:
static bool IsNegativeInfinity (
    double d
)
public static boolean IsNegativeInfinity (
    double d
)
public static function IsNegativeInfinity (
    d : double
) : boolean

参数

  • d
    一个双精度浮点数字。

返回值

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

备注

浮点运算返回 NegativeInfinity 以发出信号表示溢出状况。

示例

下面的代码示例演示 IsNegativeInfinity 的用法:

            ' 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 Then
                Console.WriteLine("Your number is bigger than a double.")
            End If

...
            ' This will equal Infinity.
            Console.WriteLine("10.0 minus NegativeInfinity equals " + (10 - Double.NegativeInfinity).ToString() + ".")
         // This will return "true".
            Console.WriteLine("IsNegativeInfinity(-5.0 / 0) == {0}.", Double.IsNegativeInfinity(-5.0 / 0) ? "true" : "false");

...
           if (d > Double.MaxValue) 
            {
                Console.WriteLine("Your number is bigger than a double.");
            }

...
           // This will equal Infinity.
            Console.WriteLine("10.0 minus NegativeInfinity equals {0}.", (10.0 - Double.NegativeInfinity).ToString());
   // This will return S"true".
   Console::WriteLine( "IsNegativeInfinity(-5.0 / 0) == {0}.", Double::IsNegativeInfinity(  -5.0 / zero ) ? (String^)"true" : "false" );

...
   if ( d > Double::MaxValue )
   {
      Console::WriteLine( "Your number is bigger than a double." );
   }

...
   // This will equal Infinity.
   Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Double::NegativeInfinity) );
        // This will return "true".
        Console.WriteLine("IsNegativeInfinity(-5.0 / 0) == {0}.", 
            (System.Double.IsNegativeInfinity((-5.0 / 0))) ? "true" : "false");

...
        if (d.doubleValue() > Double.MAX_VALUE) {
            Console.WriteLine("Your number is bigger than a double.");
        }

...
        // This will equal Infinity.
        Console.WriteLine("10.0 minus NegativeInfinity equals {0}.",
            System.Convert.ToString(10.0 - System.Double.NegativeInfinity));

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Double 结构
Double 成员
System 命名空间
IsInfinity
IsPositiveInfinity
PositiveInfinity
NegativeInfinity