I want to round numbers up to their nearest order of magnitude. (I think I said this right)
Here are some examples:
Input => Output
8 => 10
34 => 40
99 => 100
120 => 200
360 => 400
990 => 1000
1040 => 2000
1620 => 2000
5070 => 6000
9000 => 10000
Anyone know a quick way to write that in Ruby or Rails?
Essentially I need to know the order of magnitude of the number and how to round by that precision.
Thanks!