lua-users home
lua-l archive

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


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...

No there's no standard way to know the limits of numbers in lua. You need to test them by trying some operations in test loops during initialization of your code, and then use these dynamic results as if they were constants. But a Lua interpreter or compiler will never know that they are constants after the initialisation when bref to be variables during the initialization where their final value is still not known.

Le lun. 26 nov. 2018 à 22:32, Dibyendu Majumdar <mobile@majumdar.org.uk> a écrit :
On Mon, 26 Nov 2018 at 21:21, Philippe Verdy <verdyp@gmail.com> wrote:
> Unfortunately we still cannot use any strict integer type in Lua without the cost of IEEE doubles, and Lua is already inconsistent with some number operators like shifts and binary ops which truncate operands to ints but return the result by reconverting it to doubles, looking their initial restriction of range and precision.
>

Hi, Lua 5.3 has 64-bit integer types - I was not sure whether you are
thinking of an earlier version of Lua above.

Regards
Dibyendu