blob: 833d8713931709e924fcca02787c9c2ec1c4a208 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#include "fdlibm.h"
#ifdef __STDC__
double cos(double x)
#else
double cos(x)
double x;
#endif
{
double y[2], z = 0.0;
int n, ix;
ix = __HI(x);
ix &= 0x7fffffff;
if (ix <= 0x3fe921fb)
return __kernel_cos(x, z);
else if (ix >= 0x7ff00000)
return x - x;
else {
n = __ieee754_rem_pio2(x, y);
switch (n & 3) {
case 0:
return __kernel_cos(y[0], y[1]);
case 1:
return -__kernel_sin(y[0], y[1], 1);
case 2:
return -__kernel_cos(y[0], y[1]);
default:
return __kernel_sin(y[0], y[1], 1);
}
}
}
|