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?
✓ ANSWER ACCEPTED
Is there a way to round a number up if it's over 0.5?
1 answer
✓ Accepted answer
You want
- 0.49 --> 0
- 0.51 --> 1
- 1.49 --> 1
- 1.51 --> 2
- 2.49 --> 2
- 2.51 --> 3
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
But it says OVER .5!
Thank you