|
I totally missed that 0x1.8p+53 + 0x1p+52 would shift and truncate, well spotted.
Yes it must. A fixed version then: ```lua function rint(x) if x ~= x or x < -0x1p+52 or x > 0x1p+52 then -- Already an Integer, or NaN, or Inf elseif x < 0 then x = ((x - 0x1p+52) + 0x1p+52) else x = ((x + 0x1p+52) - 0x1p+52) end return math.floor(x) end ``` |