diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-02-13 01:23:48 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-02-13 01:23:48 +0000 |
commit | 5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3 (patch) | |
tree | aad692051ec8635ec14fcebf8aa714f637f3b569 /sysdeps/ieee754/dbl-64 | |
parent | 8de5da94ce5a2f01369ecc9dbe63684e6245dbdd (diff) | |
download | glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.tar glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.tar.gz glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.tar.bz2 glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.zip |
Little optimization, use sincos.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_j0.c | 3 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_j1.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/e_jn.c | 22 |
3 files changed, 17 insertions, 14 deletions
diff --git a/sysdeps/ieee754/dbl-64/e_j0.c b/sysdeps/ieee754/dbl-64/e_j0.c index 3fcec67ce4..77af5fd18c 100644 --- a/sysdeps/ieee754/dbl-64/e_j0.c +++ b/sysdeps/ieee754/dbl-64/e_j0.c @@ -201,8 +201,7 @@ V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ - s = __sin(x); - c = __cos(x); + __sincos (x, &s, &c); ss = s-c; cc = s+c; /* diff --git a/sysdeps/ieee754/dbl-64/e_j1.c b/sysdeps/ieee754/dbl-64/e_j1.c index f5f5c28830..260492ae67 100644 --- a/sysdeps/ieee754/dbl-64/e_j1.c +++ b/sysdeps/ieee754/dbl-64/e_j1.c @@ -112,8 +112,7 @@ static double zero = 0.0; if(ix>=0x7ff00000) return one/x; y = fabs(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sin(y); - c = __cos(y); + __sincos (y, &s, &c); ss = -s-c; cc = s-c; if(ix<0x7fe00000) { /* make sure y+y not overflow */ @@ -194,8 +193,7 @@ static double V0[5] = { if((ix|lx)==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sin(x); - c = __cos(x); + __sincos (x, &s, &c); ss = -s-c; cc = s-c; if(ix<0x7fe00000) { /* make sure x+x not overflow */ diff --git a/sysdeps/ieee754/dbl-64/e_jn.c b/sysdeps/ieee754/dbl-64/e_jn.c index 68abc90462..64ba79929d 100644 --- a/sysdeps/ieee754/dbl-64/e_jn.c +++ b/sysdeps/ieee754/dbl-64/e_jn.c @@ -103,11 +103,14 @@ static double zero = 0.00000000000000000000e+00; * 2 -s+c -c-s * 3 s+c c-s */ + double s; + double c; + __sincos (x, &s, &c); switch(n&3) { - case 0: temp = __cos(x)+__sin(x); break; - case 1: temp = -__cos(x)+__sin(x); break; - case 2: temp = -__cos(x)-__sin(x); break; - case 3: temp = __cos(x)-__sin(x); break; + case 0: temp = c + s; break; + case 1: temp = -c + s; break; + case 2: temp = -c - s; break; + case 3: temp = c - s; break; } b = invsqrtpi*temp/__ieee754_sqrt(x); } else { @@ -257,11 +260,14 @@ static double zero = 0.00000000000000000000e+00; * 2 -s+c -c-s * 3 s+c c-s */ + double c; + double s; + __sincos (x, &s, &c); switch(n&3) { - case 0: temp = __sin(x)-__cos(x); break; - case 1: temp = -__sin(x)-__cos(x); break; - case 2: temp = -__sin(x)+__cos(x); break; - case 3: temp = __sin(x)+__cos(x); break; + case 0: temp = s - c; break; + case 1: temp = -s - c; break; + case 2: temp = -s + c; break; + case 3: temp = s + c; break; } b = invsqrtpi*temp/__ieee754_sqrt(x); } else { |