This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: sqrt interpreter Q
- From: Tom Tromey <tromey at redhat dot com>
- To: Andreas Tobler <toa at pop dot agri dot ch>
- Cc: GCC-Java <java at gcc dot gnu dot org>
- Date: 07 Feb 2002 21:39:38 -0700
- Subject: Re: sqrt interpreter Q
- References: <3C62C85C.2665595A@pop.agri.ch>
- Reply-to: tromey at redhat dot com
>>>>> "Andreas" == Andreas Tobler <toa@pop.agri.ch> writes:
Andreas> Doing it with gij I get the following:
Andreas> [titanium:~] andreast% gij my_sqrt
Andreas> sqrt_int: -2147483648
Andreas> sqrt_double: NaN
Andreas> sqrt_long: -9223372034707292160
I looked at this a bit.
On x86 the appended program prints the `int' value.
So I think the C++ compiler translates `(int) NaN' differently from
the Java compiler.
I haven't looked into it more deeply than this. It does suggest that
the f2* and d2* instructions in the interpreter might need to be
modified to handle the special cases.
Are you interested in researching this a bit more?
Tom
#include <stdio.h>
#include <math.h>
int main ()
{
double d = -1;
int l = (int) (sqrt (d));
printf ("%d\n", l);
}