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:
 > 
 > In fact GCJ already has the ability to inline Math.* calls directly 
 > into native FPU instructions in some cases.

One other thing: I don't think we can do this in general and meet even
the more relaxed requirements of java.lang.Math, because the x86 has a
restricted range of allowable arguments to its trig functions.

Try this with -ffast-math:

public class trial
{
  static public void main (String[] argv)
  {
    System.out.println(Math.sin(Math.pow(2.0, 90.0)));
  }
}

zapata:~ $ gcj trial.java --main=trial -ffast-math -O 
zapata:~ $ ./a.out 
1.2379400392853803E27
zapata:~ $ gcj trial.java --main=trial -ffast-math   
zapata:~ $ ./a.out 
-0.9044312486086016

I think that we can agree the error is more than 1 ulp!

Andrew.


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