Different results of java and C verion of same program ?

Andrew Haley aph@redhat.com
Fri Mar 3 11:39:00 GMT 2006


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.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /