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 to x.
    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 than x.
    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) or CEILING(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.

functions of a real returning respectively the largest smaller and the smallest larger integer
{\displaystyle \lfloor x\rfloor =x-\{x\}}
{\displaystyle \lfloor x\rfloor =m}
{\displaystyle \lfloor x\rfloor }
{\displaystyle \lfloor x\rfloor \leq \lceil x\rceil ,}
In mathematics, the floor function is the function that takes as input a real number x, and gives as output the greatest integer less than or equal to x, denoted ⌊x⌋ or … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Floor_and_ceiling_functions
Floor and ceiling functions - Wikipedia
February 5, 2026 - In mathematics, the floor function is the function that takes as input a real number x, and gives as output the greatest integer less than or equal to x, denoted ⌊x⌋ or floor(x). Similarly, the ceiling function maps x to the least integer greater than or equal to x, denoted ⌈x⌉ or ceil(x). ...
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › ceil-floor-functions-cpp
Ceil and Floor functions in C++ - GeeksforGeeks
May 16, 2025 - C++ provides floor() and ceil() functions, defined in the <cmath> header file, to find the rounded-down and rounded-up values of floating-point numbers
🌐
Microsoft Support
support.microsoft.com › en-us › office › ceiling-function-0a5cd7c8-0720-4f0a-bd2c-c943e510899f
CEILING function - Microsoft Support
Returns number rounded up, away from zero, to the nearest multiple of significance. For example, if you want to avoid using pennies in your prices and your product is priced at $4.42, use the formula =CEILING(4.42,0.05) to round prices up to the nearest nickel.
🌐
W3Schools
w3schools.com › c › ref_math_ceil.php
C Math ceil() Function
The ceil() function rounds a number UP to the nearest integer.
🌐
Oracle
docs.oracle.com › en › database › oracle › oracle-database › 19 › sqlrf › CEIL.html
CEIL
November 12, 2025 - CEIL returns the smallest integer that is greater than or equal to n. The number n can always be written as the difference of an integer k and a positive fraction f such that 0 <= f < 1 and n = k - f. The value of CEIL is the integer k. Thus, the value of CEIL is n itself if and only if n is ...
🌐
IBM
ibm.com › docs › en › i › 7.4.0
CEILING or CEIL
The CEILING or CEIL function returns the smallest integer value that is greater than or equal to expression.
🌐
MedCalc
medcalc.org › en › manual › ceil-function.php
CEIL function calculator and graph - MedCalc Manual
September 9, 2025 - CEIL(x) rounds the number x up. The argument x can be a real number or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the CEIL function applied to all elements.
Find elsewhere
🌐
Databricks
docs.databricks.com › reference › sql language reference › functions › built-in functions › alphabetical list of built-in functions › ceil function
ceil function | Databricks on AWS
Returns the smallest number not smaller than expr rounded up to targetScale digits relative to the decimal point. This function is a synonym of ceiling function.
🌐
Oracle
docs.oracle.com › javadb › 10.8.3.0 › ref › rreffuncceil.html
CEIL or CEILING function
The CEIL and CEILING functions round the specified number up, and return the smallest number that is greater than or equal to the specified number.
🌐
IBM
ibm.com › docs › en › i › 7.4.0
ceil() — Find Integer >=Argument
We cannot provide a description for this page right now
🌐
PHP
php.net › manual › en › function.ceil.php
PHP: ceil - Manual
Math Functions · (PHP 4, PHP 5, PHP 7, PHP 8) ceil — Round fractions up · ceil(int|float $num): float · Returns the next highest integer value by rounding up num if necessary. num · The value to round · num rounded up to the next highest ...
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math › arithmetic operations
ceil - Round toward positive infinity - MATLAB
Y = ceil(X) rounds each element of X to the nearest integer greater than or equal to that element.
🌐
Math is Fun
mathsisfun.com › sets › function-floor-ceiling.html
Floor and Ceiling Functions
The floor and ceiling functions give us the nearest integer up or down. The Floor of 2.31 is 2 The Ceiling of 2.31 is 3.
🌐
Programiz
programiz.com › c-programming › library-function › math.h › ceil
C ceil() - C Standard Library
The ceil() function takes a single argument and returns the nearest integer number.
🌐
NV5 Geospatial Software
nv5geospatialsoftware.com › docs › CEIL.html
CEIL
View our Documentation Center document now and explore other helpful examples for using IDL, ENVI and other products.
🌐
Cppreference
en.cppreference.com › w › cpp › numeric › math › ceil.html
std::ceil, std::ceilf, std::ceill - cppreference.com
Common mathematical functions · [edit] 1-3) Computes the least integer value not less than num. The library provides overloads of std::ceil for all cv-unqualified floating-point types as the type of the parameter.(since C++23) If no errors occur, the smallest integer value not less than num, ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Math › ceil
Math.ceil() - JavaScript | MDN
The Math.ceil() static method always rounds up and returns the smallest integer greater than or equal to a given number.
🌐
AWS
docs.aws.amazon.com › amazon redshift › database developer guide › sql reference › sql functions reference › math functions › ceiling (or ceil) function
CEILING (or CEIL) function - Amazon Redshift
(The FLOOR function rounds a number down to the next whole number.) ... The number or expression that evaluates to a number. It can be the SMALLINT, INTEGER, BIGINT, DECIMAL, FLOAT4, FLOAT8, or SUPER type. CEILING and CEIL return the same data type as its argument.