C# Double IsInfinity

Description

Double IsInfinity returns a value indicating whether the specified number evaluates to negative or positive infinity

Syntax

Double.IsInfinity has the following syntax.


public static bool IsInfinity(
  double d
)

Parameters

Double.IsInfinity has the following parameters.

  • d - A double-precision floating-point number.

Returns

Double.IsInfinity method returns true if d evaluates to PositiveInfinity or NegativeInfinity; otherwise, false.

Example

The following code example illustrates the use of IsInfinity:


using System;/* www . j  a  va 2 s .  co  m*/

public class MainClass{
  public static void Main(String[] argv){  
    // This will return "true".
    Console.WriteLine("IsInfinity(3.0 / 0) == {0}.", 
                       Double.IsInfinity(3.0 / 0) ? "true" : "false");
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version