lua-users home
lua-l archive

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


I noticed a problem (which I suspect is related to the introduction of integers in Lua53), and I’d like to know if this is ‘official’ behavior, or some sort of bug.  The behavior can be seen in this small example:
 
function fact(n)
  if n == 0 then return 1 end
  return fact(n-1) * n
end
 
print(fact(66),fact(66.))
 
Using fp parameter, return correct (?) result
Using integer parameter, return 0 (zero) result!!!!
 
I don’t know what the root of this problem but if it happens to be related to integer overflow, should it be converted to floating point, and continue ‘crunching’ rather than give a completely wrong result?
 
Thanks.