Rounding
Rounding down
round down (or take the floor, or round towards minus infinity): q is the largest integer that does not exceed y.
Rounding up
round up (or take the ceiling, or round towards plus infinity): q is the smallest integer that is not less than y.
Rounding towards zero
round towards zero (or truncate, or round away from infinity): q is the integer part of y, without its fraction digits.
Rounding away from zero
round away from zero (or round towards infinity): if y is an integer, q is y; else q is the integer that is closest to 0 and is such that y is between 0 and q.
Comparison of approaches for rounding to an integer
Value | Directed | Round | ||||||||
Round | Round | Round | Round | Round half | Round half | Round half | Round half | Round half | Round half | |
+1.6 | +1 | +2 | +1 | +2 | +2 | +2 | +2 | +2 | +2 | +2 |
+1.5 | +1 | +1 | +1 | |||||||
+1.4 | +1 | +1 | +1 | |||||||
+0.6 | 0 | +1 | 0 | +1 | ||||||
+0.5 | 0 | 0 | 0 | |||||||
+0.4 | 0 | 0 | 0 | |||||||
−0.4 | −1 | 0 | −1 | |||||||
−0.5 | −1 | −1 | −1 | |||||||
−0.6 | −1 | −1 | −1 | |||||||
−1.4 | −2 | −1 | −1 | −2 | ||||||
−1.5 | −2 | −2 | −2 | |||||||
−1.6 | −2 | −2 | −2 | |||||||