Skip to content

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
rounding

Round
to nearest

Round
down
(towards −∞)

Round
up
(towards +∞)

Round
towards zero

Round
away from zero

Round half
down
(towards −∞)

Round half
up
(towards +∞)

Round half
towards zero

Round half
away from zero

Round half
to even

Round half
to odd

+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

See also

Favorite site