<div class="meta" robots="noindex">

</div>

Method

# Xojo.Math.Ceil

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `Ceiling</api/math/ceiling>` as a replacement.

</div>

## Description

Returns the ceiling of a number by rounding it up to the nearest whole number.

## Sample code

Get the ceiling of a number:

``` xojo
Using Xojo.Math

Dim d As Double
d = Ceil(1.234) ' returns 2
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ceil only works to whole numbers so if you want to round a value to a specific number of decimal places, you first have to multiple the number by 10^(number of decimal places), calculate the <span class="title-ref">Ceil</span> and then divide it by the same value to get the number. For example, this example rounds 1.2345 to 1.3:

``` xojo
Using Xojo.Math

Dim d As Double
Const kDecimalPlaces = 1

d = Ceil(1.2345 * (10 ^ kDecimalPlaces)) / (10 ^ kDecimalPlaces) ' d = 1.3
```

## Compatibility

All project types on all supported operating systems.
