I know of math.ceil and math.floor but those round the number up and down no matter what the decimal is. Is there a way to round a number to it's closest integer?
You want
This looks a lot like math.floor
. Each one on the left is just off by 0.5.
In fact, the answer is just
math.floor(x + 0.5)