123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- libm_hidden_proto(sin)
- #ifdef __STDC__
- double sin(double x)
- #else
- double sin(x)
- double x;
- #endif
- {
- double y[2],z=0.0;
- int32_t n, ix;
-
- GET_HIGH_WORD(ix,x);
-
- ix &= 0x7fffffff;
- if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0);
-
- else if (ix>=0x7ff00000) return x-x;
-
- else {
- n = __ieee754_rem_pio2(x,y);
- switch(n&3) {
- case 0: return __kernel_sin(y[0],y[1],1);
- case 1: return __kernel_cos(y[0],y[1]);
- case 2: return -__kernel_sin(y[0],y[1],1);
- default:
- return -__kernel_cos(y[0],y[1]);
- }
- }
- }
- libm_hidden_def(sin)
|