[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tostring vs. nan, inf
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 10 Apr 2012 09:38:58 -0300
> but I don't see how to detect nan portably.
function isnan(x) return x~=x end
function isinf(x) return (x+1)==x end
See http://lua-users.org/lists/lua-l/2005-02/msg00758.html for alternatives
and my lmathx for a C implementation:
http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmathx