k_sinf.c revision 151796
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
172116Sjkh#ifndef lint
1850476Speterstatic char rcsid[] = "$FreeBSD: head/lib/msun/src/k_sinf.c 151796 2005-10-28 13:36:58Z bde $";
192116Sjkh#endif
202116Sjkh
212116Sjkh#include "math.h"
222116Sjkh#include "math_private.h"
232116Sjkh
24151796Sbde/* Range of maximum relative error in polynomial: ~[-1.61e-10, 1.621e-10]. */
258870Srgrimesstatic const float
26151796Sbdehalf = 0.5,
27151796SbdeS1  = -0xaaaaab.0p-26,	/* -0.1666666716337203979492187500 */
28151796SbdeS2  =  0x8888ba.0p-30,	/*  0.008333379402756690979003906250 */
29151796SbdeS3  = -0xd02cb0.0p-36,	/* -0.0001985307317227125167846679687 */
30151796SbdeS4  =  0xbe18ff.0p-42;	/*  0.000002832675590980215929448604584 */
312116Sjkh
3297413Salfredfloat
3397413Salfred__kernel_sinf(float x, float y, int iy)
342116Sjkh{
352116Sjkh	float z,r,v;
36151620Sbde
372116Sjkh	z	=  x*x;
382116Sjkh	v	=  z*x;
39151796Sbde	r	=  S2+z*(S3+z*S4);
402116Sjkh	if(iy==0) return x+v*(S1+z*r);
412116Sjkh	else      return x-((z*(half*y-v*r)-y)-v*S1);
422116Sjkh}
43