s_tanf.c revision 2116
12116Sjkh/* s_tanf.c -- float version of s_tan.c. 22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 32116Sjkh */ 42116Sjkh 52116Sjkh/* 62116Sjkh * ==================================================== 72116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 82116Sjkh * 92116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business. 102116Sjkh * Permission to use, copy, modify, and distribute this 112116Sjkh * software is freely granted, provided that this notice 122116Sjkh * is preserved. 132116Sjkh * ==================================================== 142116Sjkh */ 152116Sjkh 162116Sjkh#ifndef lint 172116Sjkhstatic char rcsid[] = "$Id: s_tanf.c,v 1.2 1994/08/18 23:10:20 jtc Exp $"; 182116Sjkh#endif 192116Sjkh 202116Sjkh#include "math.h" 212116Sjkh#include "math_private.h" 222116Sjkh 232116Sjkh#ifdef __STDC__ 242116Sjkh float tanf(float x) 252116Sjkh#else 262116Sjkh float tanf(x) 272116Sjkh float x; 282116Sjkh#endif 292116Sjkh{ 302116Sjkh float y[2],z=0.0; 312116Sjkh int32_t n, ix; 322116Sjkh 332116Sjkh GET_FLOAT_WORD(ix,x); 342116Sjkh 352116Sjkh /* |x| ~< pi/4 */ 362116Sjkh ix &= 0x7fffffff; 372116Sjkh if(ix <= 0x3f490fda) return __kernel_tanf(x,z,1); 382116Sjkh 392116Sjkh /* tan(Inf or NaN) is NaN */ 402116Sjkh else if (ix>=0x7f800000) return x-x; /* NaN */ 412116Sjkh 422116Sjkh /* argument reduction needed */ 432116Sjkh else { 442116Sjkh n = __ieee754_rem_pio2f(x,y); 452116Sjkh return __kernel_tanf(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even 462116Sjkh -1 -- n odd */ 472116Sjkh } 482116Sjkh} 49