lua-users home
lua-l archive

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


Lua 5.3 doesn't seem to accept fractional components when passing a base

$ lua5.1 -e 'print(tonumber("9.0", 10))'
9
$ lua5.3 -e 'print(tonumber("9.0", 10))'
nil
$ lua5.3 -e 'print(tonumber("9.0"))'
9.0

Lua 5.3 performs overflow/wraparound on large numbers... but only with
limited precision.

$ lua5.1 -e 'print(tonumber("99999999999999999999999999999999999999999999999999999999999999999999999999999999"))'
1e+80
$ lua5.3 -e 'print(tonumber("99999999999999999999999999999999999999999999999999999999999999999999999999999999"))'
-1
$ lua5.1 -e 'print(tonumber("999999999999999999999999999"))'
1e+27
$ lua -e 'print(tonumber("999999999999999999999999999"))'
-6930898827444486145

Are these behaviours intentional?
Should these changes from 5.1/5.2 be documented?