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: Different results of java and C verion of same program ?


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.


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