> Finally, you can write those in Lua: > > function isnan(x) return x~=x end > function isinfinity(x) return x+1==x end Your isinfinity() won't work once you run out of mantissa bits (at around 1e16 in IEEE doubles), where 1e16+1=1e16. Jay