Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

It's clear to me how these functions work on positive real numbers: you round up or down accordingly. But if you have to round a negative real number: to take $\,-0.8\,$ to $\,-1,\,$ then do you take the floor of $\,-0.8,\,$ or the ceiling?

That is, which of the following are true?


$$\text{or}$$ $$\lceil-0.8\rceil=-1$$

share|improve this question
Look at the number line - Floor: Go to the next integer left of where you are. - Ceiling: Go to the next integer right of where you are. –  k.stm Mar 28 '13 at 15:26
Lower limit: Lower than or equal to it. Upper bound: More than or equal to it. So, First one is right.! –  Inceptio Mar 28 '13 at 15:26
@K.Stm. +1 beat me to it :) –  Tyler Mar 28 '13 at 15:27
To almost any mathematician, it is obvious: $\lfloor -1.8\rfloor=-2$. I remember however bumping into a computer implementation that gave $\lfloor -1.8\rfloor=-1$. –  André Nicolas Mar 28 '13 at 15:44

4 Answers 4

up vote 13 down vote accepted

The first is the correct: you round "down" (i.e. the greatest integer LESS THAN $-0.8$).

In contrast, the ceiling function rounds "up" to the least integer GREATER THAN $-0.8 = 0$.

$$ \begin{align} \lfloor{-0.8}\rfloor & = -1\quad & \text{since}\;\; \color{blue}{\bf -1} \lt -0.8 \lt 0 \\ \\ \lceil {-0.8} \rceil & = 0\quad &\text{since} \;\; -1 \lt -0.8 \lt \color{blue}{\bf 0} \end{align}$$

In general, we must have that $$\lfloor x \rfloor \leq x\leq \lceil x \rceil\quad \forall x \in \mathbb R$$

And so it follows that $$-1 = \lfloor -0.8 \rfloor \leq -0.8 \leq \lceil -0.8 \rceil = 0$$

K.Stm's suggestion is a nice, intuitive way to recall the relation between the floor and the ceiling of a real number $x$, especially when $x\lt 0$. Using the "number line" idea and plotting $-0.8$ with the two closest integers that "sandwich" $-0.8$ gives us:

$\qquad\qquad$enter image description here

We see that the floor of $x= -0.8$ is the first integer immediately to the left of $-0.8,\;$ and the ceiling of $x= -0.8$ is the first integer immediately to the right of $-0.8$, and this strategy can be used, whatever the value of a real number $x$.

share|improve this answer
+1 for mentioning my name!! : - ) –  k.stm Mar 28 '13 at 18:02

Keep in mind that $\lfloor x \rfloor \le x \le \lceil x \rceil$, so it's the first one.

More precisely, for $x \in \Bbb{R}$, $$ \lfloor x \rfloor = \max \{ z \in \Bbb{Z} : z \le x \} $$ while $$ \lceil x \rceil = \min \{ z \in \Bbb{Z} : x \le z \}. $$

share|improve this answer

The first one is true: $\lfloor x\rfloor\le x\le\lceil x\rceil$, no matter if $x$ is negative or not.

share|improve this answer

When $x>0$,

$\lfloor-x\rfloor= -\lfloor x\rfloor - 1$

$\lceil-x\rceil= -\lfloor x\rfloor$

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.