|
On 24/04/14 17:15, Dirk Laurie wrote:
>
> The hardest test of all is to distinguish between 0 and -0.
> If you can improve on the following, please post.
>
> if x==0 and 1/x>0 then -- x is 0
> if x==0 and 1/x<0 then -- x is -0
You can get by without the and:
> function is_minuszero (x) return 1/x == -1/0 end