lua-users home
lua-l archive

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


>>  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.

Ok, right. Sorry about that. On IEEE machines, you can use

  function isinfinity(x)
   if x>0 then return x==(1/0) else return x==(-1/0) end
  end

--lhf