[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA4.0 : Bug with maths
- From: "paulmatthews" <paulmatthews@...>
- Date: Mon, 11 Feb 2002 00:08:52 -0000
> In *some* implementations, "a" would get a true NaN,
> and "c" would be zero (NaNs are not comparable to each
> other) but in general, "a" would be nil and "c" would
> be 1, as you found out.
> --lhf
The "in general" bit does not follow the rest of the discussion. The
following C program get the correct answer. Lua should get the same
answers!
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
double a = atof("NAN");
double b = atof("NAN");
printf( "%d %d %d %d %d %d\n",
a<b, a<=b, a==b, a!=b, a>=b, a>b );
}
$ ./t
0 0 0 1 0 0