Knowledge base dedicated to Linux and applied mathematics.
Home > Latex > FAQ > Latex - FAQ > Latex ceiling function
All the versions of this article: <English> <français>
The ceiling function is a mathematical function that associates with any real number $x$ the smallest integer $n$ such that $n \geq x$, and is often noted as $\lceil x \rceil$ or $\operatorname{ceil}(x)$. In other words, the ceiling of $x$ is the smallest integer greater than or equal to $x$.
The ceil function can be easily implemented in LaTeX using the following command:
\lceil x \rceil
$\lceil x \rceil$
The ceil function is formally defined as:
$$
\lceil x \rceil = \operatorname{min}\{n \in \mathbb{Z} : n \geq x\}
$$
$$ \lceil x \rceil = \operatorname{min}\{n \in \mathbb{Z} : n \geq x\} $$
Suppose we want to round the number $x=4.7$ up to the nearest integer. We can use the $\lceil x \rceil$ function, which returns the smallest integer greater than or equal to $x$. In this case, we have:
$$
\lceil 4.7 \rceil = 5
$$
$$ \lceil 4.7 \rceil = 5 $$