k_sinf.c revision 50476
12116Sjkh/* k_sinf.c -- float version of k_sin.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 118870Srgrimes * software is freely granted, provided that this notice 122116Sjkh * is preserved. 132116Sjkh * ==================================================== 142116Sjkh */ 152116Sjkh 162116Sjkh#ifndef lint 1750476Speterstatic char rcsid[] = "$FreeBSD: head/lib/msun/src/k_sinf.c 50476 1999-08-28 00:22:10Z peter $"; 182116Sjkh#endif 192116Sjkh 202116Sjkh#include "math.h" 212116Sjkh#include "math_private.h" 222116Sjkh 232116Sjkh#ifdef __STDC__ 248870Srgrimesstatic const float 252116Sjkh#else 268870Srgrimesstatic float 272116Sjkh#endif 282116Sjkhhalf = 5.0000000000e-01,/* 0x3f000000 */ 292116SjkhS1 = -1.6666667163e-01, /* 0xbe2aaaab */ 302116SjkhS2 = 8.3333337680e-03, /* 0x3c088889 */ 312116SjkhS3 = -1.9841270114e-04, /* 0xb9500d01 */ 322116SjkhS4 = 2.7557314297e-06, /* 0x3638ef1b */ 332116SjkhS5 = -2.5050759689e-08, /* 0xb2d72f34 */ 342116SjkhS6 = 1.5896910177e-10; /* 0x2f2ec9d3 */ 352116Sjkh 362116Sjkh#ifdef __STDC__ 372116Sjkh float __kernel_sinf(float x, float y, int iy) 382116Sjkh#else 392116Sjkh float __kernel_sinf(x, y, iy) 402116Sjkh float x,y; int iy; /* iy=0 if y is zero */ 412116Sjkh#endif 422116Sjkh{ 432116Sjkh float z,r,v; 442116Sjkh int32_t ix; 452116Sjkh GET_FLOAT_WORD(ix,x); 462116Sjkh ix &= 0x7fffffff; /* high word of x */ 472116Sjkh if(ix<0x32000000) /* |x| < 2**-27 */ 482116Sjkh {if((int)x==0) return x;} /* generate inexact */ 492116Sjkh z = x*x; 502116Sjkh v = z*x; 512116Sjkh r = S2+z*(S3+z*(S4+z*(S5+z*S6))); 522116Sjkh if(iy==0) return x+v*(S1+z*r); 532116Sjkh else return x-((z*(half*y-v*r)-y)-v*S1); 542116Sjkh} 55