k_sinf.c revision 239192
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 17152869Sbde#ifndef INLINE_KERNEL_SINDF 18176451Sdas#include <sys/cdefs.h> 19176451Sdas__FBSDID("$FreeBSD: head/lib/msun/src/k_sinf.c 239192 2012-08-11 11:13:48Z dim $"); 202116Sjkh#endif 212116Sjkh 222116Sjkh#include "math.h" 232116Sjkh#include "math_private.h" 242116Sjkh 25152869Sbde/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */ 26152869Sbdestatic const double 27152869SbdeS1 = -0x15555554cbac77.0p-55, /* -0.166666666416265235595 */ 28152869SbdeS2 = 0x111110896efbb2.0p-59, /* 0.0083333293858894631756 */ 29152869SbdeS3 = -0x1a00f9e2cae774.0p-65, /* -0.000198393348360966317347 */ 30152869SbdeS4 = 0x16cd878c3b46a7.0p-71; /* 0.0000027183114939898219064 */ 312116Sjkh 32239192Sdim#ifdef INLINE_KERNEL_SINDF 33239192Sdimstatic __inline 34152647Sbde#endif 35239192Sdimfloat 36152869Sbde__kernel_sindf(double x) 372116Sjkh{ 38152951Sbde double r, s, w, z; 39151620Sbde 40152951Sbde /* Try to optimize for parallel evaluation as in k_tanf.c. */ 41152951Sbde z = x*x; 42152951Sbde w = z*z; 43152951Sbde r = S3+z*S4; 44152951Sbde s = z*x; 45152951Sbde return (x + s*(S1+z*S2)) + s*w*r; 462116Sjkh} 47