12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- #ifdef __STDC__
- static const double
- #else
- static double
- #endif
- half = 5.00000000000000000000e-01,
- S1 = -1.66666666666666324348e-01,
- S2 = 8.33333333332248946124e-03,
- S3 = -1.98412698298579493134e-04,
- S4 = 2.75573137070700676789e-06,
- S5 = -2.50507602534068634195e-08,
- S6 = 1.58969099521155010221e-10;
- #ifdef __STDC__
- double attribute_hidden __kernel_sin(double x, double y, int iy)
- #else
- double attribute_hidden __kernel_sin(x, y, iy)
- double x,y; int iy;
- #endif
- {
- double z,r,v;
- int32_t ix;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- if(ix<0x3e400000)
- {if((int)x==0) return x;}
- z = x*x;
- v = z*x;
- r = S2+z*(S3+z*(S4+z*(S5+z*S6)));
- if(iy==0) return x+v*(S1+z*r);
- else return x-((z*(half*y-v*r)-y)-v*S1);
- }
|