Little optimization, use sincos.
authordrepper <drepper>
Tue, 13 Feb 2001 01:23:45 +0000 (01:23 +0000)
committerdrepper <drepper>
Tue, 13 Feb 2001 01:23:45 +0000 (01:23 +0000)
sysdeps/ieee754/dbl-64/e_j0.c
sysdeps/ieee754/dbl-64/e_j1.c
sysdeps/ieee754/dbl-64/e_jn.c
sysdeps/ieee754/flt-32/e_j0f.c
sysdeps/ieee754/flt-32/e_j1f.c
sysdeps/ieee754/ldbl-96/e_j0l.c

index 3fcec67..77af5fd 100644 (file)
@@ -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;
        /*
index f5f5c28..260492a 100644 (file)
@@ -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 */
index 68abc90..64ba799 100644 (file)
@@ -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 {
index cbad70b..b3b2052 100644 (file)
@@ -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;
        /*
index a227bc0..26f606a 100644 (file)
@@ -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 */
index 85c54fa..79e13be 100644 (file)
@@ -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;
       /*