This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Fourth Draft "Unsafe fp optimizations" project description.
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: Fourth Draft "Unsafe fp optimizations" project description.
- From: Stephen L Moshier <moshier at mediaone dot net>
- Date: Sun, 12 Aug 2001 10:29:56 -0400 (EDT)
- cc: gcc at gcc dot gnu dot org
- Reply-To: moshier at moshier dot ne dot mediaone dot net
> However, for `sin' and `cos' this is different; the instructions might
> not be as accurate for all inputs as their library counterparts.
>
> I mention this issue below under "Open issues", because I currently
> have no idea how to deal with this.
Sine and cosine instructions are implemented for arm, convex, i386,
and m68k targets. They give high precision if the argument is small,
though m68k loses several bits in XFmode. They might not agree with
C99 for IEEE special value inputs. Otherwise, the instructions could
be used safely if one knew that the user program was performing range
reduction with sufficient accuracy.
The loss of accuracy is due to subtractive cancellation, an error source
that your document does not mention. The coprocessor calculation
is something like
x - pi * floor(x / pi)
in which two nearly equal values are subtracted but at least one of
them is inexact. Associative law rearrangements can potentially cause
a total loss of precision due to cancellation error.