The way I round numbers is by adding 0.5 and casting it to an integer. That rounds to the nearest whole number. To round to a different decimal precision, first multiply the number by 10^n, round that to the nearest whole number, then divide by 10^n.