13a8617a8SJordan K. Hubbard /* k_sinf.c -- float version of k_sin.c
23a8617a8SJordan K. Hubbard * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
311dc2417SBruce Evans * Optimized by Bruce D. Evans.
43a8617a8SJordan K. Hubbard */
53a8617a8SJordan K. Hubbard
63a8617a8SJordan K. Hubbard /*
73a8617a8SJordan K. Hubbard * ====================================================
83a8617a8SJordan K. Hubbard * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
93a8617a8SJordan K. Hubbard *
103a8617a8SJordan K. Hubbard * Developed at SunPro, a Sun Microsystems, Inc. business.
113a8617a8SJordan K. Hubbard * Permission to use, copy, modify, and distribute this
123a8617a8SJordan K. Hubbard * software is freely granted, provided that this notice
133a8617a8SJordan K. Hubbard * is preserved.
143a8617a8SJordan K. Hubbard * ====================================================
153a8617a8SJordan K. Hubbard */
163a8617a8SJordan K. Hubbard
173a8617a8SJordan K. Hubbard #include "math.h"
183a8617a8SJordan K. Hubbard #include "math_private.h"
193a8617a8SJordan K. Hubbard
2059aad933SBruce Evans /* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
2159aad933SBruce Evans static const double
2259aad933SBruce Evans S1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */
2359aad933SBruce Evans S2 = 0x111110896efbb2.0p-59, /* 0.0083333293858894631756 */
2459aad933SBruce Evans S3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */
2559aad933SBruce Evans S4 = 0x16cd878c3b46a7.0p-71; /* 0.0000027183114939898219064 */
263a8617a8SJordan K. Hubbard
27*2b795b29SDimitry Andric #ifdef INLINE_KERNEL_SINDF
28*2b795b29SDimitry Andric static __inline
294ce51209SBruce Evans #endif
30*2b795b29SDimitry Andric float
__kernel_sindf(double x)3159aad933SBruce Evans __kernel_sindf(double x)
323a8617a8SJordan K. Hubbard {
33f4b01a9eSBruce Evans double r, s, w, z;
344339c67cSBruce Evans
35f4b01a9eSBruce Evans /* Try to optimize for parallel evaluation as in k_tanf.c. */
363a8617a8SJordan K. Hubbard z = x*x;
37f4b01a9eSBruce Evans w = z*z;
38f4b01a9eSBruce Evans r = S3+z*S4;
39f4b01a9eSBruce Evans s = z*x;
40f4b01a9eSBruce Evans return (x + s*(S1+z*S2)) + s*w*r;
413a8617a8SJordan K. Hubbard }
42