This is the mail archive of the
`gcc-patches@gcc.gnu.org`
mailing list for the GCC project.

# Re: [JAVA] Implement more java.lang.Math builtins.

On Thu, 2003-05-29 at 15:45, Geoff Keating wrote:
> ast 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.
The Java language has changed since then.
A new class, java.lang.StrictMath, provides methods which give the old
behaviour as you described.
We have some more freedom in java.lang.Math now. The methods in this
class are allowed to deliver results that differ by at most 1ulp from
the correctly rounded result.
For the trig functions, I believe we need to do a separate argument
reduction step before using the x86 h/w implementations. This is
because the technique used to bring args outside of the 0 to PI/4 range
is much less precise on the h/w than in fdlibm.
See http://www.naturalbridge.com/floatingpoint/intelfp.html
AG
--
Anthony Green <green@redhat.com>
Red Hat, Inc.