e_asin.c (22993) | e_asin.c (23579) |
---|---|
1/* @(#)e_asin.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#ifndef lint | 1/* @(#)e_asin.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#ifndef lint |
14static char rcsid[] = "$Id$"; | 14static char rcsid[] = "$Id: e_asin.c,v 1.6 1997/02/22 15:09:57 peter Exp $"; |
15#endif 16 17/* __ieee754_asin(x) 18 * Method : 19 * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... 20 * we approximate asin(x) on [0,0.5] by 21 * asin(x) = x + x*x^2*R(x^2) 22 * where --- 75 unchanged lines hidden (view full) --- 98 w = p/q; 99 return x+x*w; 100 } 101 /* 1> |x|>= 0.5 */ 102 w = one-fabs(x); 103 t = w*0.5; 104 p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); 105 q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); | 15#endif 16 17/* __ieee754_asin(x) 18 * Method : 19 * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... 20 * we approximate asin(x) on [0,0.5] by 21 * asin(x) = x + x*x^2*R(x^2) 22 * where --- 75 unchanged lines hidden (view full) --- 98 w = p/q; 99 return x+x*w; 100 } 101 /* 1> |x|>= 0.5 */ 102 w = one-fabs(x); 103 t = w*0.5; 104 p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); 105 q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); |
106 s = sqrt(t); | 106 s = __ieee754_sqrt(t); |
107 if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ 108 w = p/q; 109 t = pio2_hi-(2.0*(s+s*w)-pio2_lo); 110 } else { 111 w = s; 112 SET_LOW_WORD(w,0); 113 c = (t-w*w)/(s+w); 114 r = p/q; 115 p = 2.0*s*r-(pio2_lo-2.0*c); 116 q = pio4_hi-2.0*w; 117 t = pio4_hi-(p-q); 118 } 119 if(hx>0) return t; else return -t; 120} | 107 if(ix>=0x3FEF3333) { /* if |x| > 0.975 */ 108 w = p/q; 109 t = pio2_hi-(2.0*(s+s*w)-pio2_lo); 110 } else { 111 w = s; 112 SET_LOW_WORD(w,0); 113 c = (t-w*w)/(s+w); 114 r = p/q; 115 p = 2.0*s*r-(pio2_lo-2.0*c); 116 q = pio4_hi-2.0*w; 117 t = pio4_hi-(p-q); 118 } 119 if(hx>0) return t; else return -t; 120} |