lua-users home
lua-l archive

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


Lua uses doubles on 32bit machines, shouldn't 64bit machines use long
doubles or even quadruple precision floats ?

2009/3/6 John Barham <jbarham@gmail.com>:
> Hi all, Lua newbie (but long-time C and Python programmer) here, and
> apologies if this issue has already been resolved.
>
> Given the following:
>
>  1. Lua's number type is conventionally a typedef for 64-bit double
> precision floating-point numbers
>  2. 64-bit floats can only represent integers up to 53 bits of precision
>  3. 64-bit machines are becoming increasingly popular
>
> is there a case for adding a separate integer numeric type to Lua?  Or
> would it be feasible to emulate Python's arbitrary precision "long"
> integer type that is automatically created on overflow?
>
> I appreciate that currently having only one numeric type helps keep
> Lua simple, but I fear that on 64-bit machines Lua's number type might
> not be able to represent common integer values such as process ids or
> file offsets.
>
>  John
>