lua-users home
lua-l archive

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


On Sun, Jul 31, 2016 at 9:33 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
What about this one?

function round (x)
  return math.floor((x % 2.0 == 0.5) and x or x + 0.5)
end

> (2^52+1)|0, round(2^52+1)
4503599627370497    4503599627370498