Fourth Draft "Unsafe fp optimizations" project description.
Stephen L Moshier
moshier@mediaone.net
Sun Aug 12 07:30:00 GMT 2001
> 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.
More information about the Gcc
mailing list