[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 10:50:24 -0300
> > function isnan(x) return x~=x end
> > function isinf(x) return (x+1)==x end
>
> Well, there seems to be a problem with the second one :
>
> > return 1e16
> 1e+016
> > return isinf(1e16)
> true
Sorry. This should work:
function isinf(x) return (1/x)==0 end
- References:
- tostring vs. nan, inf, Alexander Gladysh
- Re: tostring vs. nan, inf, Luiz Henrique de Figueiredo
- Re: tostring vs. nan, inf, Alexander Gladysh
- Re: tostring vs. nan, inf, Martin Guy
- Re: tostring vs. nan, inf, Luiz Henrique de Figueiredo
- Re: tostring vs. nan, inf, Patrick Rapin