wine/libs/musl/src/math/__sindf.c
2023-04-07 13:29:46 +02:00

38 lines
1 KiB
C

/* origin: FreeBSD /usr/src/lib/msun/src/k_sinf.c */
/*
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
* Optimized by Bruce D. Evans.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include "libm.h"
/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */
static const double
S1 = -0x1.5555555555555p-3,
S2 = 0x1.1111111111111p-7,
S3 = -0x1.a01a01a01a01ap-13,
S4 = 0x1.71de3a556c734p-19;
float __sindf(double x)
{
double_t r, s, w, z;
/* Try to optimize for parallel evaluation as in __tandf.c. */
z = x*x;
if (x > -7.8175831586122513e-03 && x < 7.8175831586122513e-03)
return x * (1 + S1 * z);
w = z*z;
r = S3 + z*S4;
s = z*x;
return (x + s*(S1 + z*S2)) + s*w*r;
}