The ceil function returns the smallest integer that is greater than or equal to a given number. It is commonly used to round numbers up to the nearest whole number.
In Mathematics
The ceiling function maps a real number $ x $ to the least integer greater than or equal to $ x $, denoted $ \lceil x \rceil $.
Example: $ \lceil 2.3 \rceil = 3 $, $ \lceil -2.3 \rceil = -2 $.
In Programming Languages
JavaScript:
Math.ceil(x)returns the smallest integer greater than or equal tox.
Example:Math.ceil(7.004)→8,Math.ceil(-7.004)→-7.C/C++:
ceil()(from<cmath>or<math.h>) returns the smallest integer not less than the argument.
Example:ceil(2.3)→3.0,ceil(-2.3)→-2.0.Python:
math.ceil(x)returns the smallest integer not less thanx.
Example:math.ceil(2.3)→3.PHP:
ceil($num)rounds up to the next highest integer.
Example:ceil(5.1)→6.SQL (Oracle, PostgreSQL, etc.):
CEIL(n)orCEILING(n)returns the smallest integer ≥n.
Example:CEIL(2.3)→3.Excel:
CEILING(number, significance)rounds a number up to the nearest multiple of significance.
Example:CEILING(4.42, 0.05)→4.45(rounds up to nearest nickel).
Key Notes
For negative numbers, ceil rounds toward zero (e.g.,
ceil(-2.3) = -2).The function always returns a floating-point value in most languages, even if the result is a whole number.
It is the opposite of the floor function, which rounds down to the nearest integer.



