C# Math Ceiling(Double)

Description

Math Ceiling(Double) returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number.

Syntax

Math.Ceiling(Double) has the following syntax.


public static double Ceiling(
  double a
)

Parameters

Math.Ceiling(Double) has the following parameters.

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

Returns

Math.Ceiling(Double) method returns The smallest integral value that is greater than or equal to a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned. Note that this method returns a Double instead of an integral type.

Example

The following example illustrates the Math.Ceiling(Double) method.


using System;/*from  ww  w .  j a va 2s .  c o m*/

public class MainClass{
  public static void Main(String[] argv){  
    Console.WriteLine(Math.Ceiling(1.2));
  }
}
   

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