David Given wrote:
I don't believe there's an easy way of doing 'ordinary' rounding; that is, 1.2 -> 1, 1.8 -> 2. In C, this is rint().
num >= 0 and math.floor(num+0.5) or math.floor(num-0.5) -- Shmuel