blob: 52170f23dcba4b1e394a74d56033023639005da2 (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
#include <LibC/assert.h>
#include <LibM/math.h>
extern "C" {
double trunc(double x)
{
return (int)x;
}
double cos(double angle)
{
return sin(angle + M_PI_2);
}
double ampsin(double angle)
{
double looped_angle = fmod(M_PI + angle, M_TAU) - M_PI;
double looped_angle_squared = looped_angle * looped_angle;
double quadratic_term;
if (looped_angle > 0) {
quadratic_term = -looped_angle_squared;
} else {
quadratic_term = looped_angle_squared;
}
double linear_term = M_PI * looped_angle;
return quadratic_term + linear_term;
}
double sin(double angle)
{
double vertical_scaling = M_PI_2 * M_PI_2;
return ampsin(angle) / vertical_scaling;
}
double pow(double x, double y)
{
(void)x;
(void)y;
ASSERT_NOT_REACHED();
}
double ldexp(double, int exp)
{
(void)exp;
ASSERT_NOT_REACHED();
}
double tanh(double)
{
ASSERT_NOT_REACHED();
}
double tan(double angle)
{
return ampsin(angle) / ampsin(M_PI_2 + angle);
}
double sqrt(double x)
{
double res;
__asm__("fsqrt" : "=t"(res) : "0"(x));
return res;
}
double sinh(double)
{
ASSERT_NOT_REACHED();
}
double log10(double)
{
ASSERT_NOT_REACHED();
}
double log(double)
{
ASSERT_NOT_REACHED();
}
double fmod(double index, double period)
{
return index - trunc(index / period) * period;
}
double exp(double)
{
ASSERT_NOT_REACHED();
}
double cosh(double)
{
ASSERT_NOT_REACHED();
}
double atan2(double, double)
{
ASSERT_NOT_REACHED();
}
double atan(double)
{
ASSERT_NOT_REACHED();
}
double asin(double)
{
ASSERT_NOT_REACHED();
}
double acos(double)
{
ASSERT_NOT_REACHED();
}
double fabs(double value)
{
return value < 0 ? -value : value;
}
double log2(double)
{
ASSERT_NOT_REACHED();
}
float log2f(float)
{
ASSERT_NOT_REACHED();
}
long double log2l(long double)
{
ASSERT_NOT_REACHED();
}
double frexp(double, int*)
{
ASSERT_NOT_REACHED();
}
float frexpf(float, int*)
{
ASSERT_NOT_REACHED();
}
long double frexpl(long double, int*)
{
ASSERT_NOT_REACHED();
}
}
|