Export (0) Print
Expand All

Math.Ceiling Method (Double)

Returns the smallest integer greater than or equal to the specified double-precision floating-point number.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public static double Ceiling (
	double a
)
public static double Ceiling (
	double a
)
public static function Ceiling (
	a : double
) : double
Not applicable.

Parameters

a

A double-precision floating-point number.

Return Value

The smallest integer greater than or equal to a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned.

The behavior of this method follows IEEE Standard 754, section 4. This kind of rounding is sometimes called rounding toward positive infinity. In other words, if a is positive, the presence of any fractional component causes a to be rounded to the next highest integer. If a is negative, the rounding operation causes any fractional component of a to be discarded. The operation of this method differs from the Floor method, which supports rounding toward negative infinity.

The following example illustrates the Math.Ceiling(Double) method and contrasts it with the Floor(Double) method.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

ADD
Show:
© 2015 Microsoft