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 | |
parent | 8de5da94ce5a2f01369ecc9dbe63684e6245dbdd (diff) | |
download | glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.tar.gz glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.tar.xz glibc-5d2a88a70e3a40d93e7c6c821b9f22746b3a11a3.zip |
Little optimization, use sincos.
Diffstat (limited to 'sysdeps')
-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 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/e_j0f.c | 3 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/e_j1f.c | 6 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/e_j0l.c | 3 |
6 files changed, 21 insertions, 22 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 { diff --git a/sysdeps/ieee754/flt-32/e_j0f.c b/sysdeps/ieee754/flt-32/e_j0f.c index cbad70b92d..b3b20524f9 100644 --- a/sysdeps/ieee754/flt-32/e_j0f.c +++ b/sysdeps/ieee754/flt-32/e_j0f.c @@ -147,8 +147,7 @@ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ - s = __sinf(x); - c = __cosf(x); + __sincosf (x, &s, &c); ss = s-c; cc = s+c; /* diff --git a/sysdeps/ieee754/flt-32/e_j1f.c b/sysdeps/ieee754/flt-32/e_j1f.c index a227bc09f1..26f606a08a 100644 --- a/sysdeps/ieee754/flt-32/e_j1f.c +++ b/sysdeps/ieee754/flt-32/e_j1f.c @@ -67,8 +67,7 @@ static float zero = 0.0; if(ix>=0x7f800000) return one/x; y = fabsf(x); if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sinf(y); - c = __cosf(y); + __sincosf (y, &s, &c); ss = -s-c; cc = s-c; if(ix<0x7f000000) { /* make sure y+y not overflow */ @@ -138,8 +137,7 @@ static float V0[5] = { if(ix==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ - s = __sinf(x); - c = __cosf(x); + __sincosf (x, &s, &c); ss = -s-c; cc = s-c; if(ix<0x7f000000) { /* make sure x+x not overflow */ diff --git a/sysdeps/ieee754/ldbl-96/e_j0l.c b/sysdeps/ieee754/ldbl-96/e_j0l.c index 85c54fa9d6..79e13be662 100644 --- a/sysdeps/ieee754/ldbl-96/e_j0l.c +++ b/sysdeps/ieee754/ldbl-96/e_j0l.c @@ -235,8 +235,7 @@ __ieee754_y0l (x) * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one. */ - s = __sinl (x); - c = __cosl (x); + __sincosl (x, &s, &c); ss = s - c; cc = s + c; /* |