+++ /dev/null
-/* @(#)s_sin.c 5.1 93/09/24 */\r
-/*\r
- * ====================================================\r
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
- *\r
- * Developed at SunPro, a Sun Microsystems, Inc. business.\r
- * Permission to use, copy, modify, and distribute this\r
- * software is freely granted, provided that this notice\r
- * is preserved.\r
- * ====================================================\r
- */\r
-#include <LibConfig.h>\r
-#include <sys/EfiCdefs.h>\r
-#if defined(LIBM_SCCS) && !defined(lint)\r
-__RCSID("$NetBSD: s_sin.c,v 1.10 2002/05/26 22:01:58 wiz Exp $");\r
-#endif\r
-\r
-/* sin(x)\r
- * Return sine function of x.\r
- *\r
- * kernel function:\r
- * __kernel_sin ... sine function on [-pi/4,pi/4]\r
- * __kernel_cos ... cose function on [-pi/4,pi/4]\r
- * __ieee754_rem_pio2 ... argument reduction routine\r
- *\r
- * Method.\r
- * Let S,C and T denote the sin, cos and tan respectively on\r
- * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2\r
- * in [-pi/4 , +pi/4], and let n = k mod 4.\r
- * We have\r
- *\r
- * n sin(x) cos(x) tan(x)\r
- * ----------------------------------------------------------\r
- * 0 S C T\r
- * 1 C -S -1/T\r
- * 2 -S -C T\r
- * 3 -C S -1/T\r
- * ----------------------------------------------------------\r
- *\r
- * Special cases:\r
- * Let trig be any of sin, cos, or tan.\r
- * trig(+-INF) is NaN, with signals;\r
- * trig(NaN) is that NaN;\r
- *\r
- * Accuracy:\r
- * TRIG(x) returns trig(x) nearly rounded\r
- */\r
-\r
-#include "math.h"\r
-#include "math_private.h"\r
-\r
-double\r
-sin(double x)\r
-{\r
- double y[2],z=0.0;\r
- int32_t n, ix;\r
-\r
- /* High word of x. */\r
- GET_HIGH_WORD(ix,x);\r
-\r
- /* |x| ~< pi/4 */\r
- ix &= 0x7fffffff;\r
- if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0);\r
-\r
- /* sin(Inf or NaN) is NaN */\r
- else if (ix>=0x7ff00000) return x-x;\r
-\r
- /* argument reduction needed */\r
- else {\r
- n = __ieee754_rem_pio2(x,y);\r
- switch(n&3) {\r
- case 0: return __kernel_sin(y[0],y[1],1);\r
- case 1: return __kernel_cos(y[0],y[1]);\r
- case 2: return -__kernel_sin(y[0],y[1],1);\r
- default:\r
- return -__kernel_cos(y[0],y[1]);\r
- }\r
- }\r
-}\r