Print this page




  81 #define S0      C[0]
  82 #define S1      C[1]
  83 #define S2      C[2]
  84 #define S3      C[3]
  85 #define C0      C[4]
  86 #define C1      C[5]
  87 #define C2      C[6]
  88 #define C3      C[7]
  89 #define C4      C[8]
  90 #define invpio2 C[9]
  91 #define half    C[10]
  92 #define pio2_1  C[11]
  93 #define pio2_t  C[12]
  94 
  95 void
  96 sincosf(float x, float *s, float *c)
  97 {
  98         double  y, z, w;
  99         float   f, g;
 100         int     n, ix, hx, hy;

 101 
 102         hx = *((int *)&x);
 103         ix = hx & 0x7fffffff;
 104 
 105         y = (double)x;
 106 
 107         if (ix <= 0x4016cbe4) {              /* |x| < 3*pi/4 */
 108                 if (ix <= 0x3f490fdb) {              /* |x| < pi/4 */
 109                         if (ix <= 0x39800000) {      /* |x| <= 2**-12 */
 110                                 volatile int    i = (int)y;
 111 #ifdef lint
 112                                 i = i;
 113 #endif
 114                                 *s = x;
 115                                 *c = 1.0f;
 116                                 return;
 117                         }
 118                         z = y * y;
 119                         *s = (float)((y * (S0 + z * S1)) *
 120                             (S2 + z * (S3 + z)));
 121                         *c = (float)(((C0 + z * C1) + (z * z) * C2) *
 122                             (C3 + z * (C4 + z)));
 123                 } else if (hx > 0) {
 124                         y = (y - pio2_1) - pio2_t;
 125                         z = y * y;
 126                         *s = (float)(((C0 + z * C1) + (z * z) * C2) *
 127                             (C3 + z * (C4 + z)));
 128                         *c = (float)-((y * (S0 + z * S1)) *
 129                             (S2 + z * (S3 + z)));
 130                 } else {




  81 #define S0      C[0]
  82 #define S1      C[1]
  83 #define S2      C[2]
  84 #define S3      C[3]
  85 #define C0      C[4]
  86 #define C1      C[5]
  87 #define C2      C[6]
  88 #define C3      C[7]
  89 #define C4      C[8]
  90 #define invpio2 C[9]
  91 #define half    C[10]
  92 #define pio2_1  C[11]
  93 #define pio2_t  C[12]
  94 
  95 void
  96 sincosf(float x, float *s, float *c)
  97 {
  98         double  y, z, w;
  99         float   f, g;
 100         int     n, ix, hx, hy;
 101         volatile int i;
 102 
 103         hx = *((int *)&x);
 104         ix = hx & 0x7fffffff;
 105 
 106         y = (double)x;
 107 
 108         if (ix <= 0x4016cbe4) {              /* |x| < 3*pi/4 */
 109                 if (ix <= 0x3f490fdb) {              /* |x| < pi/4 */
 110                         if (ix <= 0x39800000) {      /* |x| <= 2**-12 */
 111                                 i = (int)y;
 112 #ifdef lint
 113                                 i = i;
 114 #endif
 115                                 *s = x;
 116                                 *c = 1.0f;
 117                                 return;
 118                         }
 119                         z = y * y;
 120                         *s = (float)((y * (S0 + z * S1)) *
 121                             (S2 + z * (S3 + z)));
 122                         *c = (float)(((C0 + z * C1) + (z * z) * C2) *
 123                             (C3 + z * (C4 + z)));
 124                 } else if (hx > 0) {
 125                         y = (y - pio2_1) - pio2_t;
 126                         z = y * y;
 127                         *s = (float)(((C0 + z * C1) + (z * z) * C2) *
 128                             (C3 + z * (C4 + z)));
 129                         *c = (float)-((y * (S0 + z * S1)) *
 130                             (S2 + z * (S3 + z)));
 131                 } else {