On one of our targets a PowerPc P2020 we accountered a problem with the
casting from double to int. The instruction that casts from double to in
checks for the size of the number and traps on numbers that don't fit
the int.
The probem is the lua_number2int(k, n) in cases n > INT_MAX
I use the default definition which is:
/* the following definitions always work, but may be slow */
#define lua_number2int(i,n) ((i)=(int)(n))
So much about the "always work" :-)
Now I looked into the C rationale and was not really sure if this is a
non-standard behaviour, the standard says that in a cast to int the
result is not defined in this case, but it doesn't say that the
behaviour is undefined.