lua-users home
lua-l archive

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


It seems to me that there is an inconsistency in how lua handles the
min and the max integer literals. The following code ends without any
error both in Lua 5.3 and Lua 5.4.

```
-- Max integer, both literal and reference are ok
assert(tostring(math.maxinteger) == '9223372036854775807')
assert(tostring(9223372036854775807) == '9223372036854775807')
assert(math.type(9223372036854775807) == 'integer')

-- Min integer+1, literal is ok
assert(tostring(-9223372036854775807) == '-9223372036854775807')
assert(math.type(-9223372036854775807) == 'integer')

-- Min integer, reference is ok
assert(tostring(math.mininteger) == '-9223372036854775808')
assert(math.type(math.mininteger) == 'integer')

-- Min integer literal, BUG ???
assert(tostring(-9223372036854775808) == '-9.2233720368548e+018')
assert(math.type(-9223372036854775808) == 'float')
```

Is it a bug?