This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: weird optimization in sin+cos, x86 backend
On 2012-02-03 16:57:19 +0100, Michael Matz wrote:
> > And it may be important that some identities (like cos^2+sin^2=1) be
> > preserved.
>
> Well, you're not going to get this without much more work in sin/cos.
If you use the glibc sin() and cos(), you already have this (possibly
up to a few ulp's).
> > For the glibc, I've finally reported a bug here:
> >
> > http://sourceware.org/bugzilla/show_bug.cgi?id=13658
>
> That is about 1.0e22, not the obscene 4.47460300787e+182 of the original
> poster.
But 1.0e22 cannot be handled correctly.
> Btw, the correct results for sin are about .7021835074240, and
> cos about -.71199601256024, so the sum is about -.0098125051362. His math
> library didn't get these results in either way. Nevertheless it doesn't
> make sense to require such precision for these input for a math library
> intended to be used for normal means.
That's just your opinion.
> If you want to have precise numbers use an arbitrary precision math
> library.
This is double precision. An arbitrary precision math library (even
though I develop one) shouldn't be needed.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)