This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sqrt interpreter Q


>>>>> "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);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]