lua-users home
lua-l archive

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


>>>>> "Dirk" == Dirk Laurie <dirk.laurie@gmail.com> writes:

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

 Dirk> On my system (Ubuntu 18.04, amd64 processor), the second-last
 Dirk> assertion fails, but the last one succeeds.

The assert(tostring(-9223372036854775808) == '-9.2233720368548e+018')
is fragile in that it makes assumptions about the float output format
that may not be true - e.g. whether the exponent is given as e+018
or e+18 (which is what I get on freebsd) or e18.

-- 
Andrew.