k_sinf.c revision 152647
12116Sjkh/* k_sinf.c -- float version of k_sin.c
22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3151796Sbde * Optimized by Bruce D. Evans.
42116Sjkh */
52116Sjkh
62116Sjkh/*
72116Sjkh * ====================================================
82116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
92116Sjkh *
102116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business.
112116Sjkh * Permission to use, copy, modify, and distribute this
128870Srgrimes * software is freely granted, provided that this notice
132116Sjkh * is preserved.
142116Sjkh * ====================================================
152116Sjkh */
162116Sjkh
17152647Sbde#ifndef INLINE_KERNEL_SINF
182116Sjkh#ifndef lint
1950476Speterstatic char rcsid[] = "$FreeBSD: head/lib/msun/src/k_sinf.c 152647 2005-11-21 04:57:12Z bde $";
202116Sjkh#endif
21152647Sbde#endif
222116Sjkh
232116Sjkh#include "math.h"
242116Sjkh#include "math_private.h"
252116Sjkh
26152341Sbde/* |sin(x)/x - s(x)| < 2**-32.5 (~[-1.57e-10, 1.572e-10]). */
278870Srgrimesstatic const float
28151796Sbdehalf = 0.5,
29152341SbdeS1  = -0xaaaaab.0p-26,		/* -0.16666667163 */
30152341SbdeS2  =  0x8888bb.0p-30,		/*  0.0083333803341 */
31152341SbdeS3  = -0xd02de1.0p-36,		/* -0.00019853517006 */
32152341SbdeS4  =  0xbe6dbe.0p-42;		/*  0.0000028376084629 */
332116Sjkh
34152647Sbde#ifdef INLINE_KERNEL_SINF
35152647Sbdeextern inline
36152647Sbde#endif
3797413Salfredfloat
3897413Salfred__kernel_sinf(float x, float y, int iy)
392116Sjkh{
402116Sjkh	float z,r,v;
41151620Sbde
422116Sjkh	z	=  x*x;
432116Sjkh	v	=  z*x;
44151796Sbde	r	=  S2+z*(S3+z*S4);
452116Sjkh	if(iy==0) return x+v*(S1+z*r);
462116Sjkh	else      return x-((z*(half*y-v*r)-y)-v*S1);
472116Sjkh}
48