> 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
* 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
* 3 13
* sin(x) ~ x + S1*x + ... + S6*x
* |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))
-- To unsubscribe: send e-mail to email@example.com with 'unsubscribe' as the subject. Do not send it to firstname.lastname@example.org
Copyright © 1995-1997 Red Hat Software. Legal notices