Ceil

From Real Software Documentation

Jump to: navigation, search
Method

Returns the value specified rounded up to the nearest integer.


Syntax

result=Ceil (value)

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

Notes

The Ceil function returns the value passed to it rounded up to the nearest integer.


Examples

This example uses the Ceil function to return ceiling of a number.

Dim d as Double
d=Ceil(1.234) //returns 2


Because Ceil 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 Ceil of that number and divide it by 10^(the number of decimal places to which you wish to round). In this example, the value 1.2345 is being rounded to two decimal places:

Dim d as Double
d=Ceil(1.234*100)/100

See Also

Floor, Round functions.

Personal tools