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: libjava configure question


Bryce McKinlay writes:
 > Andrew Haley wrote:
 > 
 > > > Hmm, thats quite surprising. Are you sure this was using the real math 
 > > > library functions and not substituting FPU instructions? Do you have 
 > > > some test case that checks for conformance?
 > >
 > >The first result comes from the standard library, the second from GMP,
 > >calculated to high precision.  The Java spec says that the answer must
 > >be right +/- 1 ulp.
 > >
 > > $ gcc trial.c -lmpfr -lgmp -lm
 > > $ ./a.out 
 > >-0.005361336007789623
 > >-9.0443124860860158093619738795260971475e-1
 > 
 > Ah, bummer. It works on x86_64, though:
 > 
 > $ gcc sintest.c -O2 -lm -lgmp -lmpfr
 > $ ./a.out
 > -0.9044312486086016
 > -9.0443124860860158093619738795260971475e-1
 > 
 > And we could still inline other math functions, besides the trig ones...?
 
Sure.  Some functions are fairly hard to get wrong: log() and exp()
fall into this category.  Others, such as pow() and the trig
functions, are surprisingly difficult.  I image we could use log() and
exp() from the sysem lib in all cases.  Maybe the inverse trig
functions too.

It's not impossible to write configury tests for accuracy of system
functions.  But, of course, we don't know the cases in which we'd get
better performance by using them.

Andrew.


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