local num = 10.6
✓ ANSWER ACCEPTED
how would i round up instead of down with math.floor?
1 answer
✓ Accepted answer
You could use math.ceil().
local num = math.ceil()
4 comments
0
That rounds up to 1 even if the number is, say, 0.3. That's not technically rounding.
0
I would downvote this answer, but it's not entirely inaccurate (and there's a chance it is what he was looking for).
0
k whtver
0
It IS the answer to his question. math.ceil() rounds up instead of down like math.floor(). If he asked how to round to nearest number, then that would be a different story.
This discussion is preserved as it was. New answers, comments, and votes are closed.

9 comments
math.floor(num + 0.5)
If this helped, be sure to put [Solved] in the title so that people know you don't need any more help.
You can also use string.format to round to any place: local function round(x, n) return tonumber(string.format("%."..n.."f", x)) end
Aether, > = math.floor(0.5) = 0, math.ceil(0.5) = 1
you're forgetting about ceil
Did you actually read my comment...?
math.floor(0 + 0.5) -> 0, math.floor(0.2 + 0.5) -> 0, math.floor(0.5 + 0.5) -> 1, and, finally, math.floor(0.9 + 0.5) -> 1.
It works exactly as math.round would work if it existed (math.floor(num + 0.5), that is).
Did you not read what he wrote,, KDarren12?