I have the following test case:
Lua 5.3.2 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> foo = 1000000000000000000
> bar = foo + 1
> bar
1000000000000000001
> string.format("%.0f", foo)
1000000000000000000
> string.format("%.0f", bar)
1000000000000000000
That last line should be 1000000000000000001
, since that's the value of bar
, but for some reason it's not. This doesn't only apply to 1000000000000000000
, I've yet to find another number over that one which gives the correct value. Can anyone give an explanation for why this happens?