Programmed Math/Rounding

Rounding is a function that deals with a sort of "evening" of numbers, to make them closer to a specific target, say a 5 or a 10, in this we say a number is nicely rounded, or round.

Here is an example:

Number a is 23.

(a): While our number remains at 23, we could either move it up (to 25) or down (to 20). Since the number is closer to 20, we make the number 20.

(b): Our number is now 26. This number is above 5. And since 30-4 =26, we will increase the number to 30, because of the small gap.


But what about the number 5? For all numbers what include 5, we round them up to the nearest 10.

(c): Number = 25. New number = 30 (after rounding).