lua-users home
lua-l archive

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

On Jul 24, 2013, at 6:39 PM, Petite Abeille wrote:

> On Jul 17, 2013, at 10:10 AM, David Demelier <> wrote:
>> I just hope that one of these 2 solutions will be approved and added
>> for the final Lua 5.3
> What about neither?
> Out of curiosity… as the 46 (and counting) messages in this thread haven't made it very clear, at least to me… why do we even care if a number is an integer, float, real, double, whatnot? Isn't the purpose of that int vs. float dichotomy to be purely an implementation detail? Wholly transparent?

No. For some numbers n>0, n+1==n. For other numbers, n+1<0.

In general, you can't tell by static inspection what will happen when the "+" operator is used.

> And a number stays a number? Irrespectively of internal representation? Or?

Yes, numbers stay numbers. Sometimes their behavior between the maximum precise integral float (probably 2^53) and the maximum unsigned int interpreted as a 2s complement number (probably 2^63-1) may produce unexpectedly precise results compared to Lua 5.2. The behavior above that range is...well, not intuitive to me.

I would guess just about all integer-oriented Lua 5.2 code starts blowing up at around 2^53, since if n+1==n, then (n+1)-1~=n, etc etc etc.

OpenWrt does have a "transparent, except for the ability to precisely represent [2^53+1, 2^63-1]" patch.