Member-only story
What’s the difference between round up, round down, round half down and round half up?
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
.
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