Re: using linux instead of osf

David Mosberger (davidm@azstarnet.com)
Tue, 26 Nov 1996 20:26:00 -0700 (MST)

> > > David Mosberger-Tang wrote:
> >
> > > [ Answering the following: ]
> >
> > > Naively, one would expect that, to compute the sine of some
> > > argument in single precision would require *less* fp operations than
> > > to get it correct up to double precision.
> >
> > You have a good point here.
> ....
> > The algorithm per se is the same. I don't
> > recall off-hand how many bits of precisions you get with each step in
> > a Taylor series, but it seems to me that you should be able to save
> > one or two steps when using single-precision.

> Ugh! I do hope that these routines do not use Taylor expansions
> to compute elementary functions. If yes, then no wonder that DEC
> library is so much faster. I do not have right now neither hardware
> nor sources, but in general Taylor expansions converge very slowly.
> There are better ways to compute such things.

Don't quote me on the "Taylor" part. Actually, upon closer inspection
there is a comment that simply says "polynomial of degree 13"---it
doesn't say how they arrived at that polynomial. Here are the
comments:

* Algorithm
* 1. Since sin(-x) = -sin(x), we need only to consider positive x.
* 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0.
* 3. sin(x) is approximated by a polynomial of degree 13 on
* [0,pi/4]
* 3 13
* sin(x) ~ x + S1*x + ... + S6*x
* where
*
* |sin(x) 2 4 6 8 10 12 | -58
* |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2
* | x |
*
* 4. sin(x+y) = sin(x) + sin'(x')*y
* ~ sin(x) + (1-x*x/2)*y
* For better accuracy, let
* 3 2 2 2 2
* r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))
* then 3 2
* sin(x) = x + (S1*x + (x *(r-y/2)+y))

--david

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com



Feedback | Store | News | Support | Product Errata | About Us | Linux Info | Search | JumpWords
No Frames | Show Frames

Copyright © 1995-1997 Red Hat Software. Legal notices