lua-users home
lua-l archive

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


On Wed, Jul 6, 2016 at 5:25 PM, Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
The same test under Lua 5.3.3 on Linux Mint 17 gives wrong result only for math.floor:
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
; a = 2^53-1
; =("%.f"):format(a)
9007199254740991
; =(-a)%(a-1)
9.007199254741e+15
; =math.floor((-a)/(a-1))
-1


More interesting observation on Lua 5.3.3:
; math.floor((-a)/(a-1))
-1
; (-a)//(a-1)
-2.0

It was surprising for me to see these expressions have different results.