Which function is used to find the smallest integer value that is greater than or equal to the argument on mathematical integer?

The Math.ceil() function always rounds up and returns the smaller integer greater than or equal to a given number.

Try it

Syntax

Parameters

Return value

The smallest integer greater than or equal to x. It's the same value as -Math.floor(-x).

Description

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).

Examples

Using Math.ceil()

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

Specifications

Specification
ECMAScript Language Specification
# sec-math.ceil

Browser compatibility

BCD tables only load in the browser

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

ParameterDescription
number Required. A numeric value

Technical Details

Works in: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

ParameterDescription
number Required. A numeric value

Technical Details

Works in: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

  • Read
  • Discuss
  • 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.

    SELECT CEILING(0.8);

    Output :

    1

    Example-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.

    SELECT CEILING(PI());

    Output :

    4

    Example-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.

    SELECT CEILING(FLOOR(6 + RAND()*(20 - 6 + 1)));

    Output :

    14

    Example-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”.

    SELECT CEILING(ABS(-432.8));

    Output :

    433

    Application :
    This function is used to return the smallest integer value that is greater than or equal to a specified number.
     

    What method is used to find the smallest integer value that is greater than or equal to the argument or mathematical integer?

    ceil () is used to find the smallest integer value that is greater than or equal to the argument or mathematical integer.

    Which method returns the smallest integer greater than or equal to a number?

    ceil() The Math. ceil() function always rounds up and returns the smaller integer greater than or equal to a given number.

    Which of the following mathematical functions returns the smallest integer value greater than the argument?

    Java Math – ceil() Floor() Methods.

    What does the floor function do?

    The Math.floor() function always rounds down and returns the largest integer less than or equal to a given number.