This is the mail archive of the
mailing list for the GCC project.
Re: [JAVA] Implement more java.lang.Math builtins.
Roger Sayle <email@example.com> writes:
> Hi Andrew,
> On Thu, 29 May 2003, Andrew Haley wrote:
> > Roger Sayle writes:
> > > The following patch tweaks the gcj front-end to use GCC's built-ins
> > > for the mathematical functions atan, atan2, exp, log, pow and tan
> > > in java.lang.Math builtins.
> > I'm a bit nervous about this. The JLS is quite specific about these
> > functions and how they are to be computed, whereas (as far as I am
> > aware) gcc's builtins are not quite so well-defined. The efficiency
> > argument is compelling, however.
> > Perhaps we could enable this with a switch; perhaps it doesn't matter.
> > Comments welcome...
> I'll have to double check the wording in the JLS, but I believe that
> its doesn't require anything beyond the appropriate IEEE standards,
> with the exception that IEEE FP exceptions can/are/maybe thrown as
> java exceptions.
Last I heard, the JLS required that the math functions be implemented
as-if they were done using Sun's public domain math library, producing
bit-for-bit identical results. Since the math library didn't always
produce the correct (most accurate) result, this pretty much meant
that for complete Java conformance you had to use exactly that library.
[However, I don't think most x86 platforms actually do this.]
- Geoffrey Keating <firstname.lastname@example.org>