This is the mail archive of the gcc@gcc.gnu.org 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.



----- Original Message -----
From: "Stephen L Moshier" <moshier@mediaone.net>
To: "Toon Moene" <toon@moene.indiv.nluug.nl>
Cc: <gcc@gcc.gnu.org>
Sent: Sunday, August 12, 2001 7:29 AM
Subject: 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.
>
The internal value of pi is not exact, but it should have 66
bits of significance, on any processor model of the last 7
years, so it is difficult for a user program to perform much
more accurate range reduction.  The one commonly used range
reduction based on i386 internals which is deficient is the
one used in exp(), where glibc takes the short cut in its
external function and does not necessarily get more than float
precision.


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