From Xojo Documentation

Revision as of 17:12, 24 February 2021 by PLefebvre (talk | contribs) (See Also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Global Method

Ceiling(value as Double) As Double

New in 2020r1

Supported for all project types and targets.


result = Ceiling(value)

Part Description
result The ceiling of value.
value The value you want the ceiling of.


The result of this function is a Double, but it will always contain a whole number.

Sample Code

This code uses the Ceiling function to return ceiling of a number.

Var d As Double
d = Ceiling(1.234) // returns 2

Because Ceiling will always return a whole number, to round a decimal value to a certain number of places, you must first multiple the number by 10^(the number of decimal places to which you wish to round) then take the value returned by Ceiling of that number and divide it by 10^(the number of decimal places to which you wish to round). In this code, the value 1.2345 is being rounded to two decimal places:

Var d As Double
d = Ceiling(1.234 * 100) / 100

See Also

Floor, Round functions.