lua-users home
lua-l archive

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

On 11-Nov-05, at 3:54 PM, Mike Pall wrote:

Ah, ok. So we better leave out the L and specify these macros
as 'not allowed to throw errors'.

That's quite awkward for the integer division and modulus operators, though, and those are not used in any context where L is not available.

I'm not particularly keen on pseudo-NANs. Real NANs are hard enough to deal with. In any event, 1/0 is not a NAN, it's +infinity (another quantity hard to express with normal integer arithmetic.) So the question is, would it be a tragedy if:

  local a = 1/0

produced a compilation error when the compiler runs with integer arithmetic.

I don't think it would be. It is true that I have been known to use 1/0 in actual lua code, but I'd actually be happier to use math.maxnum provided that it were really the largest possible number and not just some big number. (math.minnum would also be necessary.)