This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c/43490] sin(x) (actually probably all trig) is inaccurate for large x



------- Comment #5 from simon dot fenney at imgtec dot com  2010-03-23 13:10 -------
(In reply to comment #4)
> > BUT sin(x) becomes progressively more inaccurate with increasing magnitude of
> > x, as with the above version (on x86). At a guess, it would seem like something
> > has broken the "range reduction" maths.  
> 
> Since pi is irrational, "range reduction" is inherently "broken" for large x.
> Try to compute sin(x) for a large value of x and its nearest values from below
> and above.

Yes, I am aware of that, but the *standard* seems to be to assume that the
source value is accurate, compute the range reduced result to sufficient
precision, and then compute sine/cosine to the required ULP accuracy. (e.g. see
Payne-Hanek reduction algorithm or any of the newer methods such as
ftp://ftp.inria.fr/INRIA/publication/dienst/RR-4267.pdf).

It was working on earlier incarnations so is frustrating that it's now broken.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43490


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