๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ JavaScript โ€บ Reference โ€บ Global_Objects โ€บ Math โ€บ ceil
Math.ceil() - JavaScript | MDN
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
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_math_ceil.asp
Python math.ceil() Method
# Import math library import math # Round a number upward to its nearest integer print(math.ceil(1.4)) print(math.ceil(5.3)) print(math.ceil(-5.3)) print(math.ceil(22.6)) print(math.ceil(10.0)) Try it Yourself ยป
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ jsref_ceil.asp
JavaScript Math ceil() Method
new Map clear() delete() entries() forEach() get() groupBy() has() keys() set() size values() JS Math ยท abs() acos() acosh() asin() asinh() atan() atan2() atanh() cbrt() ceil() clz32() cos() cosh() E exp() expm1() f16round() floor() fround() LN2 LN10 log() log10() log1p() log2() LOG2E LOG10E max() min() PI pow() random() round() sign() sin() sinh() sqrt() SQRT1_2 SQRT2 tan() tanh() trunc() JS Numbers
๐ŸŒ
STEMpedia
ai.thestempedia.com โ€บ home โ€บ python functions โ€บ math.ceil()
Learn Python math.ceil() Function | Python Programming Tutorial
June 27, 2023 - In Python, the math.ceil() function ... that is greater than the number itself. For example, the math.ceil() of 6.3 is 7, and the math.ceil() of -10.7 is -10....
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ java โ€บ lang โ€บ math_ceil.htm
Java - Math ceil(double) Method
package com.tutorialspoint; public class MathDemo { public static void main(String[] args) { // get a double number double x = 10.7; // print the ceil of the number System.out.println("Math.ceil(" + x + ")=" + Math.ceil(x)); } } Let us compile ...
๐ŸŒ
InfluxData Documentation
docs.influxdata.com โ€บ flux โ€บ v0 โ€บ stdlib โ€บ math โ€บ ceil
math.ceil() function | Flux Documentation
For more information, see Function type signatures. ... import "math" import "sampledata" sampledata.float() |> map(fn: (r) => ({r with _value: math.ceil(x: r._value)}))
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ dotnet โ€บ api โ€บ system.math.ceiling
Math.Ceiling Method (System) | Microsoft Learn
decimal[] values = {7.03m, 7.64m, 0.12m, -0.12m, -7.1m, -7.6m}; Console.WriteLine(" Value Ceiling Floor\n"); foreach (decimal value in values) Console.WriteLine("{0,7} {1,16} {2,14}", value, Math.Ceiling(value), Math.Floor(value)); // The example ...
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Floor_and_ceiling_functions
Floor and ceiling functions - Wikipedia
February 5, 2026 - In mathematics, the floor function ... example, for floor: โŒŠ2.4โŒ‹ = 2, โŒŠโˆ’2.4โŒ‹ = โˆ’3, and for ceiling: โŒˆ2.4โŒ‰ = 3, and โŒˆโˆ’2.4โŒ‰ = โˆ’2....
Find elsewhere
๐ŸŒ
TechOnTheNet
techonthenet.com โ€บ js โ€บ math_ceil.php
JavaScript: Math ceil() function
This JavaScript tutorial explains how to use the math function called ceil() with syntax and examples. In JavaScript, ceil() is a function that is used to return the smallest integer value that is greater than or equal to a number. In other words, the ceil() function rounds a number up and ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-math-ceil-function
math.ceil() function - Python - GeeksforGeeks
November 17, 2025 - It still returns the smallest integer that is not less than the given number. ... Explanation: math.ceil(-13.1) returns -13 because it is the smallest integer greater than or equal to -13.1.
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ ref_math_ceil.php
C Math ceil() Function
C Examples C Real-Life Examples ... nearest integer: printf("%f", ceil(0.60)); printf("%f", ceil(0.40)); printf("%f", ceil(5)); printf("%f", ceil(5.1)); printf("%f", ceil(-5.1)); printf("%f", ceil(-5.9)); Try it Yourself ...
๐ŸŒ
LogScale
library.humio.com โ€บ data-analysis โ€บ functions-math-ceil.html
math:ceil() | Data Analysis 1.229.0-1.231.0 | LogScale Documentation
This query is useful, for example, to calculate minimum container needs, determine upper bounds for resource allocation, or round up time durations to whole units. ... The result shows that math:ceil(3.1) = 4.0, demonstrating how the function always rounds up to the next integer regardless ...
๐ŸŒ
Brilliant
brilliant.org โ€บ wiki โ€บ ceiling-function
Ceiling Function | Brilliant Math & Science Wiki
Let \(\lceil x \rceil= y\), where \(y\) is an integer by the definition of the ceiling function. Then ยท \[\begin{align} \big\lceil \lceil x \rceil - 1.3 \big\rceil &= 16\\ \lceil y - 1.3 \rceil &= 16\\ 15 < y-1.3 &\le 16\\ 16.3 < y &\le 17.3\\ y&=17. \qquad \text{(since }y\text{ is an integer)} \end{align}\] ... (1) \( \lceil x+n \rceil = \lceil x \rceil + n,\) for any integer \( n.\) (2) \( \lceil x \rceil + \lceil -x \rceil = \begin{cases} 1 & \text{if } x \notin {\mathbb Z} \\ 0 & \text{if } x \in {\mathbb Z}. \end{cases}\) (3) \( \lceil x+y \rceil = \lceil x \rceil + \lceil y \rceil\) or \( \lceil x \rceil + \lceil y \rceil - 1.
๐ŸŒ
VEDANTU
vedantu.com โ€บ maths โ€บ ceiling function: definition, formula & examples
Ceiling Function Explained with Examples | Maths Guide
June 11, 2020 - For example, for the number 5.7, the ceiling is โŒˆ5.7โŒ‰ = 6, while the floor is โŒŠ5.7โŒ‹ = 5. 3. What is the formula for the ceiling function and how is it represented? The ceiling function is represented by the formula f(x) = โŒˆxโŒ‰. The ...
Top answer
1 of 3
3

Simply put it's two ways of thinking of rounding off a number. Ceiling rounds up to nearest integer. Floor rounds down to nearest integer. If the number is an integer, nothing happens.

2 of 3
3

It's easy to think about floor and ceil from the perspective of the number line. Let's say you have some decimal number, $2.31$ (I'm going to be using this number as an example throughout my answer) $\hskip2in$
So, as you can see, the functions just return the nearest integer values.
floor returns the nearest lowest integer and ceil returns the nearest highest integer.

All real numbers are made of a characteristic (an integer part) and mantissa (a fractional part) $$\text{Number} = \text{Characteristic} + \text{Mantissa}$$ $$2.31 = 2 + 0.31$$

When floor a number, you can think of it as replacing the Mantissa with $0$ $$\lfloor 2.31 \rfloor = 2 + 0 = 2$$

and ceil can be thought of as replacing the mantissa with $1$. $$\lceil 2.31 \rceil = 2 + 1 = 3$$

That's not a very popular way of thinking about it but it was the way I thought about it when I first started using it in programming.

Remember, the number remains the same when it is an integer. ie, floor($3$) $=$ ceil($3$) $= 3$


Let's now look at the proper definitions along with the graphs for them.

Floor Function: Returns the greatest integer that is less than or equal to $x$ $\hskip2in$

Ceiling Function: Returns the least integer that is greater than or equal to $x$ $\hskip2in$

Don't let the infinite staircase scare you. It's much more simpler than it seems. Those "line-segments" that you see are actually called piecewise-step functions.

Simply, the black dot represents 'including this number' and the white represents 'excluding this number'. Meaning that each segment actually is from x to all numbers less than x+1.


Let's look at 2.31 and how it would look on both the graphs at once. You can see that the line $x=2.31$ hits the floor function at the "line-piece" for $2$ and hits the ceiling function at $3$

๐ŸŒ
Google Support
support.google.com โ€บ docs โ€บ answer โ€บ 9061515
CEILING.MATH function - Google Docs Editors Help
For example, -4.7 is rounded up to -4. CEILING: The CEILING function rounds a number up to the nearest integer multiple of specified significance. ROUNDUP: Rounds a number to a certain number of decimal places, always rounding up to the next valid increment. ROUND: The ROUND function rounds ...
๐ŸŒ
Electricimp
developer.electricimp.com โ€บ squirrel โ€บ math โ€บ ceil
math.ceil() | Dev Center
This function returns a floating-point value representing the nearest whole number that is greater than or equal to the value passed to it. If that value is an integer it will, by definition, be the value math.ceil() returns, albeit as float not an integer.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ javascript-math-ceil-function
JavaScript Math.ceil( ) function - GeeksforGeeks
September 9, 2024 - Example 4: In this example, Math.ceil(7 + 9) calculates the ceiling of the sum, which is 16, as the result is already an integer.
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ library-function โ€บ math.h โ€บ ceil
C ceil() - C Standard Library
For example: If 2.3 is passed to ceil(), it will return 3. The function is defined in <math.h> header file.