I want to use math.floor() but it rounds to real numbers. Is there a way I can set it to round tenths not rounding it to real numbers?
✓ ANSWER ACCEPTED
Rounding to tenths?
2 answers
✓ Accepted answer
You first multiply your number by 10 round it, then divide by ten again. :)
1 comment
0
Thanks man you save lifes.
I once created a handy function for this;
function Round(Num, Decimals)
return math.floor((Num)*(10 ^Decimals) + 0.5)/(10^Decimals)
end
In your case, use
Round(x, 1) where x is your number.
Please ask if you would like an explanation :)
1 comment
0
This won't work exactly as expected for negative numbers, by the way.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
rounds to integers* rounding to reals would the identity