lua-users home
lua-l archive

Re: integer lua

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Given wrote:
I don't believe there's an easy way of doing 'ordinary' rounding; that is, 1.2 -> 1, 1.8 -> 2. In C, this is rint().
num >= 0 and math.floor(num+0.5) or math.floor(num-0.5)
--
Shmuel

AltStyle によって変換されたページ (->オリジナル) /