Does Lua make use of 64-bit integers?

后端 未结 3 501
猫巷女王i
猫巷女王i 2020-12-16 03:45

Does Lua make use of 64-bit integers? How do I use it?

3条回答
  •  醉话见心
    2020-12-16 04:18

    Lua 5.3 introduces the integer subtype, which uses 64-bit integer by default.

    From Lua 5.3 reference manual

    The type number uses two internal representations, one called integer and the other called float. Lua has explicit rules about when each representation is used, but it also converts between them automatically as needed (see §3.4.3). Therefore, the programmer may choose to mostly ignore the difference between integers and floats or to assume complete control over the representation of each number. Standard Lua uses 64-bit integers and double-precision (64-bit) floats, but you can also compile Lua so that it uses 32-bit integers and/or single-precision (32-bit) floats. The option with 32 bits for both integers and floats is particularly attractive for small machines and embedded systems. (See macro LUA_32BITS in file luaconf.h.)

提交回复
热议问题