Lines 21-28
__FBSDID("$FreeBSD$");
Link Here
|
21 |
#include "math_private.h" |
21 |
#include "math_private.h" |
22 |
|
22 |
|
23 |
/* |
23 |
/* |
24 |
* Domain [-0.7854, 0.7854], range ~[-1.80e-37, 1.79e-37]: |
24 |
* Domain [-0.7854, 0.7854], range ~[-1.17e-39, 1.19e-39]: |
25 |
* |cos(x) - c(x))| < 2**-122.0 |
25 |
* |cos(x) - c(x))| < 2**-129.3 |
26 |
* |
26 |
* |
27 |
* 113-bit precision requires more care than 64-bit precision, since |
27 |
* 113-bit precision requires more care than 64-bit precision, since |
28 |
* simple methods give a minimax polynomial with coefficient for x^2 |
28 |
* simple methods give a minimax polynomial with coefficient for x^2 |
Lines 31-51
__FBSDID("$FreeBSD$");
Link Here
|
31 |
*/ |
31 |
*/ |
32 |
static const double |
32 |
static const double |
33 |
one = 1.0; |
33 |
one = 1.0; |
34 |
|
|
|
35 |
static const long double |
34 |
static const long double |
36 |
C1 = 0.04166666666666666666666666666666658424671L, |
35 |
C1 = 4.16666666666666666666666666666666667e-02L, |
37 |
C2 = -0.001388888888888888888888888888863490893732L, |
36 |
C2 = -1.38888888888888888888888888888888834e-03L, |
38 |
C3 = 0.00002480158730158730158730158600795304914210L, |
37 |
C3 = 2.48015873015873015873015873015446795e-05L, |
39 |
C4 = -0.2755731922398589065255474947078934284324e-6L, |
38 |
C4 = -2.75573192239858906525573190949988493e-07L, |
40 |
C5 = 0.2087675698786809897659225313136400793948e-8L, |
39 |
C5 = 2.08767569878680989792098886701451072e-09L, |
41 |
C6 = -0.1147074559772972315817149986812031204775e-10L, |
40 |
C6 = -1.14707455977297247136657111139971865e-11L, |
42 |
C7 = 0.4779477332386808976875457937252120293400e-13L; |
41 |
C7 = 4.77947733238738518870113294139830239e-14L, |
43 |
|
42 |
C8 = -1.56192069685858079920640872925306403e-16L, |
44 |
static const double |
43 |
C9 = 4.11031762320473354032038893429515732e-19L, |
45 |
C8 = -0.1561920696721507929516718307820958119868e-15, |
44 |
C10= -8.89679121027589608738005163931958096e-22L, |
46 |
C9 = 0.4110317413744594971475941557607804508039e-18, |
45 |
C11= 1.61171797801314301767074036661901531e-24L, |
47 |
C10 = -0.8896592467191938803288521958313920156409e-21, |
46 |
C12= -2.46748624357670948912574279501044295e-27L; |
48 |
C11 = 0.1601061435794535138244346256065192782581e-23; |
|
|
49 |
|
47 |
|
50 |
long double |
48 |
long double |
51 |
__kernel_cosl(long double x, long double y) |
49 |
__kernel_cosl(long double x, long double y) |
Lines 54-60
__kernel_cosl(long double x, long double y)
Link Here
|
54 |
|
52 |
|
55 |
z = x*x; |
53 |
z = x*x; |
56 |
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ |
54 |
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*(C6+z*(C7+ |
57 |
z*(C8+z*(C9+z*(C10+z*C11)))))))))); |
55 |
z*(C8+z*(C9+z*(C10+z*(C11+z*C12))))))))))); |
58 |
hz = 0.5*z; |
56 |
hz = 0.5*z; |
59 |
w = one-hz; |
57 |
w = one-hz; |
60 |
return w + (((one-w)-hz) + (z*r-x*y)); |
58 |
return w + (((one-w)-hz) + (z*r-x*y)); |