The Math.ceil[] function always rounds up and returns the smaller integer greater than or equal to a given number. The smallest integer greater than or equal to x. It's the same value as -Math.floor[-x]. Because ceil[] is a static method of Math, you always use it as Math.ceil[], rather than as a method of a Math object you created [Math is not a constructor]. Math.ceil[-Infinity]; // -Infinity
Math.ceil[-7.004]; // -7
Math.ceil[-4]; // -4
Math.ceil[-0.95]; // -0
Math.ceil[-0]; // -0
Math.ceil[0]; // 0
Math.ceil[0.95]; // 1
Math.ceil[4]; // 4
Math.ceil[7.004]; // 8
Math.ceil[Infinity]; // Infinity
BCD tables only load in the browserTry it
Syntax
Parameters
Return value
Description
Examples
Using Math.ceil[]
Specifications
Specification ECMAScript Language Specification
# sec-math.ceil
Browser compatibility
See also
Example
Return the smallest integer value that is greater than or equal to a number:
SELECT CEILING[25.75] AS CeilValue;
Try it Yourself »
Definition and Usage
The CEILING[] function returns the smallest integer value that is larger than or equal to a number.
Tip: Also look at the FLOOR[] and ROUND[] functions.
Syntax
CEILING[number]
Parameter Values
number | Required. A numeric value |
Technical Details
SQL Server [starting with 2008], Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse |
More Examples
Example
Return the smallest integer value that is greater than or equal to a number:
SELECT CEILING[25] AS CeilValue;
Try it Yourself »
Example
Return the smallest integer value that is greater than or equal to a number:
SELECT CEILING[-13.5] AS CeilValue;
Try it Yourself »
❮ MySQL Functions
Example
Return the smallest integer value that is greater than or equal to 25.75:
SELECT CEIL[25.75];
Try it Yourself »
Definition and Usage
The CEIL[] function returns the smallest integer value that is bigger than or equal to a number.
Note: This function is equal to the CEILING[] function.
Syntax
CEIL[number]
Parameter Values
number | Required. A numeric value |
Technical Details
From MySQL 4.0 |
More Examples
Example
Return the smallest integer value that is greater than or equal to 25:
SELECT CEIL[25];
Try it Yourself »
❮ MySQL Functions
View Discussion
Improve Article
Save Article
View Discussion
Improve Article
Save Article
CEILING[] function :
This function in MySQL is used to
return the smallest integer value that is greater than or equal to a specified number. For example, if the specified number is 4.6, this function will return the integer value of 5 that is greater than 4.6 or if a specified number is 5, this function will return 5 that is equal to 5.
Features :
- This function is used to find the smallest integer value that is greater than or equal to a specified number.
- This function accepts a single parameter.
- The accepted parameter is a numeric value of integer or float data type.
Syntax :
CEILING[number]Parameter :
This method accepts a parameter as given below –
- number – Specified numeric value.
Returns : It returns the smallest integer value that is greater than or equal to a specified number.
Example-1 :
Getting the smallest number 1 that is greater than the specified
numeric value 0.8.
Output :
1Example-2 :
Getting the smallest number 4 that is greater than the specified numeric value “3.1415926535897931” which is the value of pi. Here the value of pi has been returned from the function PI[] and then the function CEILING[] function takes this value of pi as an argument and returned the value 4.
Output :
4Example-3 :
Getting the number
14 that is same as the returned random value between 6 and 20. Here the FLOOR[] function will return a random number between 6 and 20 then the function CEILING[] takes this returned value as parameter and returns the same number 14.
Output :
14Example-4 :
Getting the smallest number 433 that is greater than the specified numeric value “432.8” which is the absolute value of “-432.8” returned by the function ABS[]. The CEILING[] function
takes the value “432.8” as the parameter and returns the value “433”.
Output :
433Application :
This function is used to return the smallest integer value that is greater than or equal to a specified number.