s_sinf.c revision 97409
175584Sru/* s_sinf.c -- float version of s_sin.c. 275584Sru * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3104862Sru */ 475584Sru 575584Sru/* 675584Sru * ==================================================== 775584Sru * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 875584Sru * 975584Sru * Developed at SunPro, a Sun Microsystems, Inc. business. 1075584Sru * Permission to use, copy, modify, and distribute this 1175584Sru * software is freely granted, provided that this notice 1275584Sru * is preserved. 1375584Sru * ==================================================== 1475584Sru */ 1575584Sru 16#ifndef lint 17static char rcsid[] = "$FreeBSD: head/lib/msun/src/s_sinf.c 97409 2002-05-28 17:51:46Z alfred $"; 18#endif 19 20#include "math.h" 21#include "math_private.h" 22 23 float sinf(float x) 24{ 25 float y[2],z=0.0; 26 int32_t n, ix; 27 28 GET_FLOAT_WORD(ix,x); 29 30 /* |x| ~< pi/4 */ 31 ix &= 0x7fffffff; 32 if(ix <= 0x3f490fd8) return __kernel_sinf(x,z,0); 33 34 /* sin(Inf or NaN) is NaN */ 35 else if (ix>=0x7f800000) return x-x; 36 37 /* argument reduction needed */ 38 else { 39 n = __ieee754_rem_pio2f(x,y); 40 switch(n&3) { 41 case 0: return __kernel_sinf(y[0],y[1],1); 42 case 1: return __kernel_cosf(y[0],y[1]); 43 case 2: return -__kernel_sinf(y[0],y[1],1); 44 default: 45 return -__kernel_cosf(y[0],y[1]); 46 } 47 } 48} 49