Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does someone mathematically round a number to its nearest integer?

For example 1.2 would round down to 1 and 1.7 would round up to 2

share|cite|improve this question
Are you asking for an algorithm to round the number? – Chao Xu Jan 13 '11 at 18:37
up vote 6 down vote accepted

You could use the "ceiling-function / floor-function" which always rounds an integer up/down ( ).

If you want the number to be rounded the way you want you could just do

$\text{round}(x)= \lceil x-\frac{1}{2} \rceil$ Note that in this case $\text{round}(1.5)=1$

Or $\text{round'}(x)= \lfloor x+\frac{1}{2} \rfloor$ Note that in this case $\text{round'}(1.5)=2$

share|cite|improve this answer
round' is what I was after. I didn't know that floor and ceiling functions exists in mathematical syntax – ParoX Jan 13 '11 at 18:46
@BHare: in «mathematical syntax» everything you can come up with exists. – Mariano Suárez-Alvarez Jan 14 '11 at 0:39

This is equivalent to looking at the floor and ceiling functions. See this. In particular, rounding a number $y$ to an integer $q$ is the same thing as looking as $q = \text{floor}(y)$ or $q = \text{ceil}(y)$.

share|cite|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.