Re: Rounding a number to integer
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Rounding a number to integer
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2016年7月31日 15:33:34 -0300
What about this one?
function round (x)
return math.floor((x % 2.0 == 0.5) and x or x + 0.5)
end
-- Roberto