lua-users home
lua-l archive

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


I think it would stop icrementing at 2^48 or somewhere in that range... all numbers in Lua are doubles unless the Lua VM is compiled differently. So you need to apply floating point maths at your thinking.

Am 07.07.2012 17:02 schrieb <meino.cramer@gmx.de>:
Hi,

lua is based on C and in the according headers
there are the following defines:

stdint.h:# define INT8_MAX              (127)
stdint.h:# define INT16_MAX             (32767)
stdint.h:# define INT32_MAX             (2147483647)
stdint.h:# define INT64_MAX             (__INT64_C(9223372036854775807))
stdint.h:# define UINT8_MAX             (255)
stdint.h:# define UINT16_MAX            (65535)
stdint.h:# define UINT32_MAX            (4294967295U)
stdint.h:# define UINT64_MAX            (__UINT64_C(18446744073709551615))

In which way does this apply to Lua and what happens if
an overflow happens when doing something like this

a=0
while a == a do
    a=a+1
end

Best regards,
mcc