JavaScript Math.ceil( ) function Last Updated : 09 Sep, 2024 Comments Improve Suggest changes Like Article Like Report The JavaScript Math.ceil() function rounds a given number up to the nearest integer. It always rounds towards positive infinity, meaning it increases the number to the next whole number if it's not already an integer. This function is useful for rounding up values in calculations.SyntaxMath.ceil(value);Parameters: This function accepts a single parameter as the number to be rounded to its nearest integer in the upward rounding method. Return Value: The result after rounding the number passed as a parameter to the function.Examples: Input : Math.ceil(4.23)Output : 5Input : Math.ceil(0.8)Output : 1Errors and Exceptions: A non-numeric string passed as a parameter returns NaN.An array with more than 1 integer passed as a parameter returns NaN.An empty variable passed as a parameter returns NaN.An empty string passed as a parameter returns NaN.An empty array passed as a parameter returns NaN. Example 1: In this example, Math.ceil rounds a number up to the nearest integer. For negative numbers, it moves towards zero, making -2 and -2.56 round to -2. JavaScript <!-- NEGATIVE NUMBER EXAMPLE --> console.log(Math.ceil(-2)); console.log(Math.ceil(-2.56)); Output-2 -2Example 2: In this example, Math.ceil rounds numbers up to the nearest integer. For positive numbers, it moves to the next higher integer, making 2 and 2.56 round to 3. JavaScript <!-- POSITIVE NUMBER EXAMPLE --> console.log(Math.ceil(2)); console.log(Math.ceil(2.56)); Output2 3 Example 3: In this example, Math.ceil("Geeksforgeeks") returns NaN since it cannot convert the string to a number for rounding. JavaScript console.log(Math.ceil("Geeksforgeeks")); OutputNaNExample 4: In this example, Math.ceil(7 + 9) calculates the ceiling of the sum, which is 16, as the result is already an integer. JavaScript <!-- ADDITION INSIDE FUNCTION EXAMPLE --> console.log(Math.ceil(7+9)); Output16Supported Browsers:Google ChromeEdge FirefoxOperaSafari Comment More infoAdvertise with us Next Article JavaScript Math.ceil( ) function A AyushSaxena Follow Improve Article Tags : Misc JavaScript Web Technologies javascript-math Practice Tags : Misc Similar Reads JavaScript Math cbrt() Function The Javascript Math.cbrt() function is used to find the cube root of a number. The cube root of a number is denoted as Math.cbrt(x)=y such that y^3=x. Syntax: Math.cbrt(number) Parameters: This function accepts a single parameter. number: The number whose cube root you want to know. Return Value: It 1 min read Less.js Math ceil() Function Less.js is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is an extension to normal CSS which basically enhances the abilities of normal CSS and gives superpowers to it. LESS.js provides the built-in Math function that 3 min read JavaScript Math ceil() Method The JavaScript Math.ceil method is used to return the smallest integer greater than or equal to a given number. The ceil() is always used as Math.ceil() since it is a static method of Math.Syntax:Math.ceil(value)Parameters: This method accepts single parameters as mentioned above and described below 2 min read p5.js ceil() function The ceil() function in p5.js is used to calculate the ceil value of a number. This function maps to the Math.ceil() of javascript. A number's absolute value is always positive. Syntax ceil(number) Parameters: The function accepts only one parameter as mentioned above and described below: number : Th 1 min read PHP ceil( ) Function We have often used the ceiling function in mathematical problems to round up a decimal number to next greater integral value. PHP provides us with a built-in function ceil() to perform such operation. The ceil() function is a built-in function in PHP and is used to round a number to the nearest grea 1 min read What is Math in JavaScript? JavaScript provides a built-in Math object that provides a set of methods to perform mathematical operations. These operations range from basic to more complex functions like trigonometry and logarithms. The Math object allows you to perform calculations without the need for writing custom functions 2 min read JavaScript Math cbrt() Method The Math.cbrt() method is used to find the cube root of a number. Syntax:Math.cbrt(x)Parameters: This method accepts a single parameter as mentioned above and described below:x: This parameter is simply a number whose cube root needs to be found.Returns: It returns the cube root of the given number. 3 min read Tensorflow.js tf.ceil() Function Tensorflow.js is an open-source library which is being developed, and by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .ceil() function is used to find ceiling of the stated tensor input and is done element wise. Syntax : 2 min read JavaScript Math acos() Method The Javascript Math.acos( ) method is used to return the arccosine of a number in radians. The Math.acos() method returns a numeric value between 0 and pi radians. The Math acos() is a static method of Math, therefore, it is always used as Math.acos(), rather than as a method of a Math object create 2 min read JavaScript Math cosh() Method JavaScript Math.cosh() method is used to calculate the value of the hyperbolic cosine of a number.Syntax:Math.cosh(x)Â Â Parameter: This method accepts a single parameter as mentioned above and described below:x: This parameter holds a number for which the value of hyperbolic cosine is going to be ca 3 min read Like