Answered by
6 years ago Edited 6 years ago
If we look at a normal rounding function it goes like this:
2 | return math.floor(num+ 0.5 ) |
However we want to round it to a higher place. Notice how in numbers like 14.5 we round it and it becomes 15. We want that, but with 1.45, to become 1.5. This is really simple actually, all we do is multiply it by how many places we want it to go when we math.floor it, then divide it afterwards.
10th place Example:
2 | return math.floor((num* 10 )+ 0.5 )/ 10 |
100th place Example:
2 | return math.floor((num* 100 )+ 0.5 )/ 100 |
If you need any more help just ask! :D