Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/musl/src/math/__cosdf.c
4397 views
1
/* origin: FreeBSD /usr/src/lib/msun/src/k_cosf.c */
2
/*
3
* Conversion to float by Ian Lance Taylor, Cygnus Support, [email protected].
4
* Debugged and optimized by Bruce D. Evans.
5
*/
6
/*
7
* ====================================================
8
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9
*
10
* Developed at SunPro, a Sun Microsystems, Inc. business.
11
* Permission to use, copy, modify, and distribute this
12
* software is freely granted, provided that this notice
13
* is preserved.
14
* ====================================================
15
*/
16
17
#include "libm.h"
18
19
/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */
20
static const double
21
C0 = -0x1.0000000000000p-1,
22
C1 = 0x1.5555555555555p-5,
23
C2 = -0x1.6c16c16c16c17p-10,
24
C3 = 0x1.a01a01a01a01ap-16,
25
C4 = -0x1.27e4fb7789f5cp-22;
26
27
float __cosdf(double x)
28
{
29
double_t z;
30
31
z = x*x;
32
if (x > -7.8163146972656250e-03 && x < 7.8163146972656250e-03)
33
return 1 + C0 * z;
34
return 1.0 + z * (C0 + z * (C1 + z * (C2 + z * (C3 + z * C4))));
35
}
36
37