18346e333Sjtc /* k_sinf.c -- float version of k_sin.c
28346e333Sjtc * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
38346e333Sjtc */
48346e333Sjtc
58346e333Sjtc /*
68346e333Sjtc * ====================================================
78346e333Sjtc * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
88346e333Sjtc *
98346e333Sjtc * Developed at SunPro, a Sun Microsystems, Inc. business.
108346e333Sjtc * Permission to use, copy, modify, and distribute this
118346e333Sjtc * software is freely granted, provided that this notice
128346e333Sjtc * is preserved.
138346e333Sjtc * ====================================================
148346e333Sjtc */
158346e333Sjtc
16dd7adfbfSlukem #include <sys/cdefs.h>
17d1f06e0bSjtc #if defined(LIBM_SCCS) && !defined(lint)
18*aa30599eSwiz __RCSID("$NetBSD: k_sinf.c,v 1.7 2002/05/26 22:01:53 wiz Exp $");
198346e333Sjtc #endif
208346e333Sjtc
218346e333Sjtc #include "math.h"
228346e333Sjtc #include "math_private.h"
238346e333Sjtc
248346e333Sjtc static const float
258346e333Sjtc half = 5.0000000000e-01,/* 0x3f000000 */
268346e333Sjtc S1 = -1.6666667163e-01, /* 0xbe2aaaab */
278346e333Sjtc S2 = 8.3333337680e-03, /* 0x3c088889 */
288346e333Sjtc S3 = -1.9841270114e-04, /* 0xb9500d01 */
298346e333Sjtc S4 = 2.7557314297e-06, /* 0x3638ef1b */
308346e333Sjtc S5 = -2.5050759689e-08, /* 0xb2d72f34 */
318346e333Sjtc S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */
328346e333Sjtc
33*aa30599eSwiz float
__kernel_sinf(float x,float y,int iy)34*aa30599eSwiz __kernel_sinf(float x, float y, int iy)
358346e333Sjtc {
368346e333Sjtc float z,r,v;
37b0c9d092Sjtc int32_t ix;
388346e333Sjtc GET_FLOAT_WORD(ix,x);
398346e333Sjtc ix &= 0x7fffffff; /* high word of x */
408346e333Sjtc if(ix<0x32000000) /* |x| < 2**-27 */
418346e333Sjtc {if((int)x==0) return x;} /* generate inexact */
428346e333Sjtc z = x*x;
438346e333Sjtc v = z*x;
448346e333Sjtc r = S2+z*(S3+z*(S4+z*(S5+z*S6)));
458346e333Sjtc if(iy==0) return x+v*(S1+z*r);
468346e333Sjtc else return x-((z*(half*y-v*r)-y)-v*S1);
478346e333Sjtc }
48