-
Notifications
You must be signed in to change notification settings - Fork 182
/
cmath
207 lines (196 loc) · 4.42 KB
/
cmath
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/* Copyright (C) 2006 Garrett A. Kajmowicz
This file is part of the uClibc++ Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <math.h>
#ifndef __STD_HEADER_CMATH
#define __STD_HEADER_CMATH 1
namespace std{
#if ! defined(__AVR__)
using ::acos;
using ::asin;
using ::atan;
using ::atan2;
using ::ceil;
using ::cos;
using ::cosh;
using ::exp;
using ::fabs;
using ::floor;
using ::fmod;
using ::frexp;
using ::ldexp;
using ::log;
using ::log10;
using ::modf;
using ::pow;
using ::sin;
using ::sinh;
using ::sqrt;
using ::tan;
using ::tanh;
inline float abs (float x){
return fabsf(x);
}
inline float acos (float x){
return acosf(x);
}
inline float asin (float x){
return asinf(x);
}
inline float atan (float x){
return atanf(x);
}
inline float atan2(float y, float x){
return atan2f(y, x);
}
inline float ceil (float x){
return ceilf(x);
}
inline float cos (float x){
return cosf(x);
}
inline float cosh (float x){
return coshf(x);
}
inline float exp (float x){
return expf(x);
}
inline float fabs (float x){
return fabsf(x);
}
inline float floor(float x){
return floorf(x);
}
inline float fmod (float x, float y){
return fmodf(x, y);
}
inline float frexp(float x, int* exp){
return frexpf(x, exp);
}
inline float ldexp(float x, int exp){
return ldexpf(x, exp);
}
inline float log (float x){
return logf(x);
}
inline float log10(float x){
return log10f(x);
}
inline float modf (float x, float* inptr){
return modff(x, inptr);
}
inline float pow (float x, float y){
return powf(x, y);
}
inline float pow (float x, int y){
return pow((double)x, (double)y);
}
inline float sin (float x){
return sinf(x);
}
inline float sinh (float x){
return sinhf(x);
}
inline float sqrt (float x){
return sqrtf(x);
}
inline float tan (float x){
return tanf(x);
}
inline float tanh (float x){
return tanhf(x);
}
inline double abs(double x){
return fabs(x);
}
inline double pow(double x, int y){
return pow((double)x, (double)y);
}
#ifdef __UCLIBCXX_HAS_LONG_DOUBLE__
inline long double abs (long double x){
return fabsl(x);
}
inline long double acos (long double x){
return acosl(x);
}
inline long double asin (long double x){
return asinl(x);
}
inline long double atan (long double x){
return atanl(x);
}
inline long double atan2(long double y, long double x){
return atan2l(y, x);
}
inline long double ceil (long double x){
return ceill(x);
}
inline long double cos (long double x){
return cosl(x);
}
inline long double cosh (long double x){
return coshl(x);
}
inline long double exp (long double x){
return expl(x);
}
inline long double fabs (long double x){
return fabsl(x);
}
inline long double floor(long double x){
return floorl(x);
}
inline long double frexp(long double x, int* exp){
return frexpl(x, exp);
}
inline long double fmod (long double x, long double y){
return fmodl(x, y);
}
inline long double ldexp(long double x, int y){
return ldexpl(x, y);
}
inline long double log (long double x){
return logl(x);
}
inline long double log10(long double x){
return log10l(x);
}
inline long double modf (long double x, long double* iptr){
return modfl(x, iptr);
}
inline long double pow (long double x, long double y){
return powl(x, y);
}
inline long double pow (long double x, int y){
return powl(x, (long double)y );
}
inline long double sin (long double x){
return sinl(x);
}
inline long double sinh (long double x){
return sinhl(x);
}
inline long double sqrt (long double x){
return sqrtl(x);
}
inline long double tan (long double x){
return tanl(x);
}
inline long double tanh (long double x){
return tanhl(x);
}
#endif // __UCLIBCXX_HAS_LONG_DOUBLE__
#endif // ! defined(__AVR__)
}
#endif //__STD_HEADER_CMATH