What’s the difference between round up, round down, round half down and round half up?

Jamie Wen
3 min readAug 26, 2020

Rounding can be tricky, especially when you are dealing with negative numbers

What is Rounding?

Should I care about rounding at all? If you’ve heard round-up round-half-down floor ceiling , then you already know it to some degree. 👇 is the Wikipedia explanation:

Rounding means replacing a number with an approximate value that has a shorter, simpler, or more explicit representation. For example, replacing $23.4476 with $23.45, the fraction 312/937 with 1/3, or the expression √2 with 1.414.

The Rounding Methods

Ceiling

The least integer greater than or equal to the given x . In below Number Line, move the given number to the right side, or round towards positive infinity.

ceiling
ceil(1.7) = 2
ceil(1.5) = 2
ceil(1.1) = 2
ceil(-1.1) = -1
ceil(-1.5) = -1
ceil(-1.7) = -1

My Tips: Ceiling: round towards positive infinity

Floor

The greatest integer less than or equal to the given x , move the given number to the left side, or round towards negative infinity

--

--

Jamie Wen
Jamie Wen

Written by Jamie Wen

Software Engineer | Technical Lead | Engineering Manager https://justlearning.club

No responses yet