This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Different results of java and C verion of same program ?
- From: Andrew Haley <aph at redhat dot com>
- To: David BalaÅic <david dot balazic at hermes dot si>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 3 Mar 2006 11:41:52 +0000
- Subject: Re: Different results of java and C verion of same program ?
- References: <4408292C.8040607@hermes.si>
David Bala¾ic writes:
> Hi!
>
> I use gcc 3.3.5 (debian 3.1).
> *
> I have written a program in jav*a and compiled it with gcj.
> Then I ported it to C and compiled with gcc.
>
> They give different results !
>
> What the program does :
> - load point 4D coordinates from a an ASCII file
> (format is one point per line, like :
> 0.146584576854345 0.234453109584343 0.544867765645423
> the values are mostly between 0 and 1 , about 15 decimals)
> - convert values to double
> - compute distance between points
> - sort distances and print it out (sorted)
>
> The java version gives slightly different output than C.
> Also if I modify the C version to use "long double" type
> instead of "double" I get again different results (this time more
> similar to the C result).
>
> Can this be some compiler error ?
No.
> Computing accuracy related ?
Yes.
Have a look at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323.
Andrew.