Ceiling (Ceil)
What is it?
The Ceil function takes a single numeric argument and, if it includes a decimal point, rounds the number up to the next available integer.
What is the Syntax?
The Ceil function’s syntax is as follows:
Ceil( Argument );
Why might I want to use this?
At the end of every day, a miller bags up all the flour he has produced into 1kg bags to send it off to market. Because the amount he produces is not an exact number of kilograms, you can use the Ceil function to calculate how many bags he needs to hold all the flour.
NumberOfBags := Ceil( KilogramsOfFlour );
On Monday he produces 56.84kg of flour. Ceil(56.84) = 57 bags.
On Tuesday he produces 49.34kg of flour. Ceil(49.34) = 50 bags.
On Wednesday he produces 58.04kg of flour. Ceil(58.04) = 59 bags.
In total he needs 166 bags to contain the flour produced between Monday and Wednesday.
Alternatively, if the miller were to bag up all the flour at the end of the three days instead of every day, you would instead use the Ceil function on the total amount of flour:
Ceil( 56.84 + 49.34 + 58.04 );
This will tell him that he needs 165 bags of flour.
<< Previous: Get Sign (Sign) | Next: Floor >>