xref: /reactos/sdk/include/c++/cmath (revision 02e84521)
1//Standard C++ math declarations
2
3#pragma once
4#define _CMATH_
5
6#include <math.h>
7
8// Get rid of those macros defined in <math.h> in lieu of real functions.
9#undef abs
10#undef div
11#undef acos
12#undef asin
13#undef atan
14#undef atan2
15#undef ceil
16#undef cos
17#undef cosh
18#undef exp
19#undef fabs
20#undef floor
21#undef fmod
22#undef frexp
23#undef ldexp
24#undef log
25#undef log10
26#undef modf
27#undef pow
28#undef sin
29#undef sinh
30#undef sqrt
31#undef tan
32#undef tanh
33
34inline double
35abs(double __x)
36{ return fabs(__x); }
37
38inline float
39abs(float __x)
40{ return fabsf(__x); }
41
42inline long double
43abs(long double __x)
44{ return fabsl(__x); }
45
46inline float
47acos(float __x)
48{ return acosf(__x); }
49
50inline long double
51acos(long double __x)
52{ return acosl(__x); }
53
54inline float
55asin(float __x)
56{ return asinf(__x); }
57
58inline long double
59asin(long double __x)
60{ return asinl(__x); }
61
62inline float
63atan(float __x)
64{ return atanf(__x); }
65
66inline long double
67atan(long double __x)
68{ return atanl(__x); }
69
70inline float
71atan2(float __y, float __x)
72{ return atan2f(__y, __x); }
73
74inline long double
75atan2(long double __y, long double __x)
76{ return atan2l(__y, __x); }
77
78inline float
79ceil(float __x)
80{ return ceilf(__x); }
81
82inline long double
83ceil(long double __x)
84{ return ceill(__x); }
85
86inline float
87cos(float __x)
88{ return cosf(__x); }
89
90inline long double
91cos(long double __x)
92{ return cosl(__x); }
93
94inline float
95cosh(float __x)
96{ return coshf(__x); }
97
98inline long double
99cosh(long double __x)
100{ return coshl(__x); }
101
102inline float
103exp(float __x)
104{ return expf(__x); }
105
106inline long double
107exp(long double __x)
108{ return expl(__x); }
109
110inline float
111fabs(float __x)
112{ return fabsf(__x); }
113
114inline long double
115fabs(long double __x)
116{ return fabsl(__x); }
117
118inline float
119floor(float __x)
120{ return floorf(__x); }
121
122inline long double
123floor(long double __x)
124{ return floorl(__x); }
125
126inline float
127fmod(float __x, float __y)
128{ return fmodf(__x, __y); }
129
130inline long double
131fmod(long double __x, long double __y)
132{ return fmodl(__x, __y); }
133
134inline float
135frexp(float __x, int* __exp)
136{ return frexpf(__x, __exp); }
137
138inline long double
139frexp(long double __x, int* __exp)
140{ return frexpl(__x, __exp); }
141
142inline float
143ldexp(float __x, int __exp)
144{ return ldexpf(__x, __exp); }
145
146inline long double
147ldexp(long double __x, int __exp)
148{ return ldexpl(__x, __exp); }
149
150inline float
151log(float __x)
152{ return logf(__x); }
153
154inline long double
155log(long double __x)
156{ return logl(__x); }
157
158inline float
159log10(float __x)
160{ return log10f(__x); }
161
162inline long double
163log10(long double __x)
164{ return log10l(__x); }
165
166inline float
167modf(float __x, float* __iptr)
168{ return modff(__x, __iptr); }
169
170inline long double
171modf(long double __x, long double* __iptr)
172{ return modfl(__x, __iptr); }
173
174inline float
175pow(float __x, float __y)
176{ return powf(__x, __y); }
177
178inline long double
179pow(long double __x, long double __y)
180{ return powl(__x, __y); }
181
182inline double
183pow(double __x, int __i)
184{ return pow(__x, static_cast<double>(__i)); }
185
186inline float
187pow(float __x, int __n)
188{ return powf(__x, static_cast<float>(__n)); }
189
190inline long double
191pow(long double __x, int __n)
192{ return powl(__x, static_cast<long double>(__n)); }
193
194inline float
195sin(float __x)
196{ return sinf(__x); }
197
198inline long double
199sin(long double __x)
200{ return sinl(__x); }
201
202inline float
203sinh(float __x)
204{ return sinhf(__x); }
205
206inline long double
207sinh(long double __x)
208{ return sinhl(__x); }
209
210inline float
211sqrt(float __x)
212{ return sqrtf(__x); }
213
214inline long double
215sqrt(long double __x)
216{ return sqrtl(__x); }
217
218inline float
219tan(float __x)
220{ return tanf(__x); }
221
222inline long double
223tan(long double __x)
224{ return tanl(__x); }
225
226inline float
227tanh(float __x)
228{ return tanhf(__x); }
229
230inline long double
231tanh(long double __x)
232{ return tanhl(__x); }
233
234namespace std
235{
236  using ::abs;
237  using ::acos;
238  using ::asin;
239  using ::atan;
240  using ::atan2;
241  using ::ceil;
242  using ::cos;
243  using ::cosh;
244  using ::exp;
245  using ::fabs;
246  using ::floor;
247  using ::fmod;
248  using ::frexp;
249  using ::ldexp;
250  using ::log;
251  using ::log10;
252  using ::modf;
253  using ::pow;
254  using ::sin;
255  using ::sinh;
256  using ::sqrt;
257  using ::tan;
258  using ::tanh;
259}
260