lua-users home
lua-l archive

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

It was thus said that the Great Dibyendu Majumdar once stated:
> On Mon, 26 Nov 2018 at 21:47, Philippe Verdy <> wrote:
> >
> > That is not true. Lua is designed to allow its number type to be
> > configurable but in its default configuration it just uses what C gives
> > as a double.
> >
> > Nothing indicates it can store any 64 bit integer and in fact it can
> > almost never store them in a single number, unless Lua is specifically
> > compiled using long double in C and they are represented as 80 bit with
> > a 64 bit mantissa part...
> >
> Hi, above is incorrect. I know as I maintain Ravi a derivative of Lua
> 5.3. Integers are maintained natively as integer values in 5.3.
> Conversion to double happens as per C promotion rules - when you do
> operations that involve integer and double values. I am a bit
> concerned that you may be stating things as if they are true when they
> are not.
> I would suggest you try out Lua 5.3 and look at its source code.

  It's even stated in the Lua 5.3 Reference Manual, section 2.1:

	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.


  Also, the constants math.maxinteger and math.mininteger are defined to
determine the limits of integers in Lua 5.3.