# Decimal.Ceiling Method

.NET Framework 4.5

Returns the smallest integral value that is greater than or equal to the specified decimal number.

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

## Syntax

```'Declaration
Public Shared Function Ceiling ( _
d As Decimal _
) As Decimal
```

#### Parameters

d
Type: System.Decimal

A decimal number.

#### Return Value

Type: System.Decimal
The smallest integral value that is greater than or equal to the d parameter. Note that this method returns a Decimal instead of an integral type.

## Remarks

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 d is positive, the presence of any fractional component causes d to be rounded to the next highest integer. If d is negative, the rounding operation causes any fractional component of d to be discarded. The operation of this method differs from the Floor method, which supports rounding toward negative infinity.

## Examples

The following example illustrates the Ceiling method and contrasts it with the Floor method.

```Module Example
Public Sub Main()
Dim values() As Decimal = {12.6d, 12.1d, 9.5d, 8.16d, .1d, -.1d,
-1.1d, -1.9d, -3.9d}
Console.WriteLine("{0,-8} {1,10} {2,10}",
"Value", "Ceiling", "Floor")
Console.WriteLine()
For Each value As Decimal In values
Console.WriteLine("{0,-8} {1,10} {2,10}", value,
Decimal.Ceiling(value), Decimal.Floor(value))
Next
End Sub
End Module
' The example displays the following output:
'       Value       Ceiling      Floor
'
'       12.6             13         12
'       12.1             13         12
'       9.5              10          9
'       8.16              9          8
'       0.1               1          0
'       -0.1              0         -1
'       -1.1             -1         -2
'       -1.9             -1         -2
'       -3.9             -3         -4
```

## Version Information

#### .NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

#### .NET Framework Client Profile

Supported in: 4, 3.5 SP1

#### Portable Class Library

Supported in: Portable Class Library

#### .NET for Windows Store apps

Supported in: Windows 8

#### .NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

## Platforms

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.