This is the mail archive of the mailing list for the GCC project.

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

Re: Fourth Draft "Unsafe fp optimizations" project description.

> 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.

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