]>
Commit | Line | Data |
---|---|---|
ff2b942e BK |
1 | // -*- C++ -*- header wrapper. |
2 | ||
3 | // Copyright (C) 1997-1999 Free Software Foundation, Inc. | |
4 | // | |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 2, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING. If not, write to the Free | |
18 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | // USA. | |
20 | ||
21 | // As a special exception, you may use this file as part of a free software | |
22 | // library without restriction. Specifically, if other files instantiate | |
23 | // templates or use macros or inline functions from this file, or you compile | |
24 | // this file and link it with other files to produce an executable, this | |
25 | // file does not by itself cause the resulting executable to be covered by | |
26 | // the GNU General Public License. This exception does not however | |
27 | // invalidate any other reasons why the executable file might be covered by | |
28 | // the GNU General Public License. | |
29 | ||
30 | // | |
31 | // ISO C++ 14882: 26.5 C library | |
32 | // | |
33 | ||
34 | #ifndef _CPP_CMATH | |
35 | #define _CPP_CMATH 1 | |
36 | ||
54fa7415 SK |
37 | # include <bits/c++config.h> |
38 | ||
6dad70df | 39 | namespace _C_legacy { |
ff2b942e | 40 | extern "C" { |
6dad70df | 41 | # define _IN_C_LEGACY_ |
811e551b | 42 | # pragma system_header |
ff2b942e BK |
43 | # include_next <math.h> |
44 | } | |
45 | inline double _CPP_HUGE_VAL_capture() { return HUGE_VAL; } | |
54fa7415 SK |
46 | #if _GLIBCPP_HAVE_BUILTIN_ACOSF |
47 | inline float _CPP_acos_capture(float __x) | |
48 | { return __builtin_acosf(__x); } | |
49 | #elif _GLIBCPP_HAVE_ACOSF | |
50 | inline float _CPP_acos_capture(float __x) | |
51 | { return acosf(__x); } | |
52 | #else | |
53 | inline float _CPP_acos_capture(float __x) | |
54 | { return acos(static_cast<double>(__x)); } | |
55 | #endif | |
56 | ||
57 | #if _GLIBCPP_HAVE_BUILTIN_ASINF | |
58 | inline float _CPP_asin_capture(float __x) | |
59 | { return __builtin_asinf(__x); } | |
60 | #elif _GLIBCPP_HAVE_ASINF | |
61 | inline float _CPP_asin_capture(float __x) | |
62 | { return asinf(__x); } | |
63 | #else | |
64 | inline float _CPP_asin_capture(float __x) | |
65 | { return asin(static_cast<double>(__x)); } | |
66 | #endif | |
67 | ||
68 | #if _GLIBCPP_HAVE_BUILTIN_ATANF | |
69 | inline float _CPP_atan_capture(float __x) | |
70 | { return __builtin_atanf(__x); } | |
71 | #elif _GLIBCPP_HAVE_ATANF | |
72 | inline float _CPP_atan_capture(float __x) | |
73 | { return atanf(__x); } | |
74 | #else | |
75 | inline float _CPP_atan_capture(float __x) | |
76 | { return atan(static_cast<double>(__x)); } | |
77 | #endif | |
78 | ||
79 | #if _GLIBCPP_HAVE_BUILTIN_ATAN2F | |
80 | inline float _CPP_atan2_capture(float __y, float __x) | |
81 | { return __builtin_atan2f(__y, __x); } | |
82 | #elif _GLIBCPP_HAVE_ATAN2F | |
83 | inline float _CPP_atan2_capture(float __y, float __x) | |
84 | { return atan2f(__y, __x); } | |
85 | #else | |
86 | inline float _CPP_atan2_capture(float __y, float __x) | |
87 | { return atan2(static_cast<double>(__y), static_cast<double>(__x)); } | |
88 | #endif | |
89 | ||
90 | #if _GLIBCPP_HAVE_BUILTIN_CEILF | |
91 | inline float _CPP_ceil_capture(float __x) | |
92 | { return __builtin_ceilf(__x); } | |
93 | #elif _GLIBCPP_HAVE_CEILF | |
94 | inline float _CPP_ceil_capture(float __x) | |
95 | { return ceilf(__x); } | |
96 | #else | |
97 | inline float _CPP_ceil_capture(float __x) | |
98 | { return ceil(static_cast<double>(__x)); } | |
99 | #endif | |
100 | ||
101 | #if _GLIBCPP_HAVE_BUILTIN_COSF | |
102 | inline float _CPP_cos_capture(float __x) | |
103 | { return __builtin_cosf(__x); } | |
104 | #elif _GLIBCPP_HAVE_COSF | |
105 | inline float _CPP_cos_capture(float __x) | |
106 | { return cosf(__x); } | |
107 | #else | |
108 | inline float _CPP_cos_capture(float __x) | |
109 | { return cos(static_cast<double>(__x)); } | |
110 | #endif | |
111 | ||
112 | #if _GLIBCPP_HAVE_BUILTIN_COSHF | |
113 | inline float _CPP_cosh_capture(float __x) | |
114 | { return __builtin_coshf(__x); } | |
115 | #elif _GLIBCPP_HAVE_COSHF | |
116 | inline float _CPP_cosh_capture(float __x) | |
117 | { return coshf(__x); } | |
118 | #else | |
119 | inline float _CPP_cosh_capture(float __x) | |
120 | { return cosh(static_cast<double>(__x)); } | |
121 | #endif | |
122 | ||
123 | #if _GLIBCPP_HAVE_BUILTIN_EXPF | |
124 | inline float _CPP_exp_capture(float __x) | |
125 | { return __builtin_expf(__x); } | |
126 | #elif _GLIBCPP_HAVE_EXPF | |
127 | inline float _CPP_exp_capture(float __x) | |
128 | { return expf(__x); } | |
129 | #else | |
130 | inline float _CPP_exp_capture(float __x) | |
131 | { return exp(static_cast<double>(__x)); } | |
132 | #endif | |
133 | ||
134 | #if _GLIBCPP_HAVE_BUILTIN_FABSF | |
135 | inline float _CPP_fabs_capture(float __x) | |
136 | { return __builtin_fabsf(__x); } | |
137 | #elif _GLIBCPP_HAVE_FABSF | |
138 | inline float _CPP_fabs_capture(float __x) | |
139 | { return fabsf(__x); } | |
140 | #else | |
141 | inline float _CPP_fabs_capture(float __x) | |
142 | { return fabs(static_cast<double>(__x)); } | |
143 | #endif | |
144 | ||
145 | #if _GLIBCPP_HAVE_BUILTIN_FLOORF | |
146 | inline float _CPP_floor_capture(float __x) | |
147 | { return __builtin_floorf(__x); } | |
148 | #elif _GLIBCPP_HAVE_FLOORF | |
149 | inline float _CPP_floor_capture(float __x) | |
150 | { return floorf(__x); } | |
151 | #else | |
152 | inline float _CPP_floor_capture(float __x) | |
153 | { return floor(static_cast<double>(__x)); } | |
154 | #endif | |
155 | ||
156 | #if _GLIBCPP_HAVE_BUILTIN_FMODFF | |
157 | inline float _CPP_fmod_capture(float __x, float __y) | |
158 | { return __builtin_fmodf(__x, __y); } | |
159 | #elif _GLIBCPP_HAVE_FMODFF | |
160 | inline float _CPP_fmod_capture(float __x, float __y) | |
161 | { return fmodf(__x, __y); } | |
162 | #else | |
163 | inline float _CPP_fmod_capture(float __x, float __y) | |
164 | { return fmod(static_cast<double>(__x), static_cast<double>(__y)); } | |
165 | #endif | |
166 | ||
167 | #if _GLIBCPP_HAVE_BUILTIN_FREXPF | |
168 | inline float _CPP_frexp_capture(float __x, int* __exp) | |
169 | { return __builtin_frexpf(__x, __exp); } | |
170 | #elif _GLIBCPP_HAVE_FREXPF | |
171 | inline float _CPP_frexp_capture(float __x, int* __exp) | |
172 | { return frexpf(__x, __exp); } | |
173 | #else | |
174 | inline float _CPP_frexp_capture(float __x, int* __exp) | |
175 | { return frexp(__x, __exp); } | |
176 | #endif | |
177 | ||
178 | #if _GLIBCPP_HAVE_BUILTIN_LDEXPF | |
179 | inline float _CPP_ldexp_capture(float __x, int __exp) | |
180 | { return __builtin_ldexpf(__x, __exp); } | |
181 | #elif _GLIBCPP_HAVE_LDEXPF | |
182 | inline float _CPP_ldexp_capture(float __x, int __exp) | |
183 | { return ldexpf(__x, __exp); } | |
184 | #else | |
185 | inline float _CPP_ldexp_capture(float __x, int __exp) | |
186 | { return ldexp(static_cast<double>(__x), __exp); } | |
187 | #endif | |
188 | ||
189 | #if _GLIBCPP_HAVE_BUILTIN_LOGF | |
190 | inline float _CPP_log_capture(float __x) | |
191 | { return __builtin_logf(__x); } | |
192 | #elif _GLIBCPP_HAVE_LOGF | |
193 | inline float _CPP_log_capture(float __x) | |
194 | { return logf(__x); } | |
195 | #else | |
196 | inline float _CPP_log_capture(float __x) | |
197 | { return log(static_cast<double>(__x)); } | |
198 | #endif | |
199 | ||
200 | #if _GLIBCPP_HAVE_BUILTIN_LOG10F | |
201 | inline float _CPP_log10_capture(float __x) | |
202 | { return __builtin_log10f(__x); } | |
203 | #elif _GLIBCPP_HAVE_LOG10F | |
204 | inline float _CPP_log10_capture(float __x) | |
205 | { return log10f(__x); } | |
206 | #else | |
207 | inline float _CPP_log10_capture(float __x) | |
208 | { return log10(static_cast<double>(__x)); } | |
209 | #endif | |
210 | ||
211 | #if _GLIBCPP_HAVE_BUILTIN_MODFF | |
212 | inline float _CPP_modf_capture(float __x, float* __iptr) | |
213 | { return __builtin_modff(__x, __iptr); } | |
214 | #elif _GLIBCPP_HAVE_MODFF | |
215 | inline float _CPP_modf_capture(float __x, float* __iptr) | |
216 | { return modff(__x, __iptr); } | |
217 | #else | |
218 | inline float _CPP_modf_capture(float __x, float* __iptr) | |
219 | { | |
220 | double __tmp; | |
221 | double __res = _C_legacy::modf(static_cast<double>(__x), &__tmp); | |
222 | *__iptr = static_cast<float> (__tmp); | |
223 | return __res; | |
224 | } | |
225 | #endif | |
226 | ||
227 | #if _GLIBCPP_HAVE_BUILTIN_POWF | |
228 | inline float _CPP_pow_capture(float __x, float __y) | |
229 | { return __builtin_powf(__x, __y); } | |
230 | #elif _GLIBCPP_HAVE_POWF | |
231 | inline float _CPP_pow_capture(float __x, float __y) | |
232 | { return powf(__x, __y); } | |
233 | #else | |
234 | inline float _CPP_pow_capture(float __x, float __y) | |
235 | { return pow(static_cast<double>(__x), static_cast<double>(__y)); } | |
236 | #endif | |
237 | ||
238 | float pow(float, int); | |
239 | ||
240 | #if _GLIBCPP_HAVE_BUILTIN_SINF | |
241 | inline float _CPP_sin_capture(float __x) | |
242 | { return __builtin_sinf(__x); } | |
243 | #elif _GLIBCPP_HAVE_SINF | |
244 | inline float _CPP_sin_capture(float __x) | |
245 | { return sinf(__x); } | |
246 | #else | |
247 | inline float _CPP_sin_capture(float __x) | |
248 | { return sin(static_cast<double>(__x)); } | |
249 | #endif | |
250 | ||
251 | #if _GLIBCPP_HAVE_BUILTIN_SINHF | |
252 | inline float _CPP_sinh_capture(float __x) | |
253 | { return __builtin_sinhf(__x); } | |
254 | #elif _GLIBCPP_HAVE_SINHF | |
255 | inline float _CPP_sinh_capture(float __x) | |
256 | { return sinhf(__x); } | |
257 | #else | |
258 | inline float _CPP_sinh_capture(float __x) | |
259 | { return sinh(static_cast<double>(__x)); } | |
260 | #endif | |
261 | ||
262 | #if _GLIBCPP_HAVE_BUILTIN_SQRTF | |
263 | inline float _CPP_sqrt_capture(float __x) | |
264 | { return __builtin_sqrtf(__x); } | |
265 | #elif _GLIBCPP_HAVE_SQRTF | |
266 | inline float _CPP_sqrt_capture(float __x) | |
267 | { return sqrtf(__x); } | |
268 | #else | |
269 | inline float _CPP_sqrt_capture(float __x) | |
270 | { return sqrt(static_cast<double>(__x)); } | |
271 | #endif | |
272 | ||
273 | #if _GLIBCPP_HAVE_BUILTIN_TANF | |
274 | inline float _CPP_tan_capture(float __x) | |
275 | { return __builtin_tanf(__x); } | |
276 | #elif _GLIBCPP_HAVE_TANF | |
277 | inline float _CPP_tan_capture(float __x) | |
278 | { return tanf(__x); } | |
279 | #else | |
280 | inline float _CPP_tan_capture(float __x) | |
281 | { return tan(static_cast<double>(__x)); } | |
282 | #endif | |
283 | ||
284 | #if _GLIBCPP_HAVE_BUILTIN_TANHF | |
285 | inline float _CPP_tanh_capture(float __x) | |
286 | { return __builtin_tanhf(__x); } | |
287 | #elif _GLIBCPP_HAVE_TANHF | |
288 | inline float _CPP_tanh_capture(float __x) | |
289 | { return tanhf(__x); } | |
290 | #else | |
291 | inline float _CPP_tanh_capture(float __x) | |
292 | { return tanh(static_cast<double>(__x)); } | |
293 | #endif | |
294 | ||
295 | // | |
296 | // double | |
297 | // | |
298 | ||
299 | #if _GLIBCPP_HAVE_BUILTIN_ACOS | |
300 | inline double _CPP_acos_capture(double __x) | |
301 | { return __builtin_acos(__x); } | |
302 | #else | |
303 | inline double _CPP_acos_capture(double __x) | |
304 | { return acos(__x); } | |
305 | #endif | |
306 | ||
307 | #if _GLIBCPP_HAVE_BUILTIN_ASIN | |
308 | inline double _CPP_asin_capture(double __x) | |
309 | { return __builtin_asin(__x); } | |
310 | #else | |
311 | inline double _CPP_asin_capture(double __x) | |
312 | { return asin(__x); } | |
313 | #endif | |
314 | ||
315 | #if _GLIBCPP_HAVE_BUILTIN_ATAN | |
316 | inline double _CPP_atan_capture(double __x) | |
317 | { return __builtin_atan(__x); } | |
318 | #else | |
319 | inline double _CPP_atan_capture(double __x) | |
320 | { return atan(__x); } | |
321 | #endif | |
322 | ||
323 | #if _GLIBCPP_HAVE_BUILTIN_ATAN2 | |
324 | inline double _CPP_atan2_capture(double __y, double __x) | |
325 | { return __builtin_atan2(__y, __x); } | |
326 | #else | |
327 | inline double _CPP_atan2_capture(double __y, double __x) | |
328 | { return atan2(__y, __x); } | |
329 | #endif | |
330 | ||
331 | #if _GLIBCPP_HAVE_BUILTIN_CEIL | |
332 | inline double _CPP_ceil_capture(double __x) | |
333 | { return __builtin_fceil(__x); } | |
334 | #else | |
335 | inline double _CPP_ceil_capture(double __x) | |
336 | { return ceil(__x); } | |
337 | #endif | |
338 | ||
339 | #if _GLIBCPP_HAVE_BUILTIN_COS | |
340 | inline double _CPP_cos_capture(double __x) | |
341 | { return __builtin_cos(__x); } | |
342 | #else | |
343 | inline double _CPP_cos_capture(double __x) | |
344 | { return cos(__x); } | |
345 | #endif | |
346 | ||
347 | #if _GLIBCPP_HAVE_BUILTIN_COSH | |
348 | inline double _CPP_cosh_capture(double __x) | |
349 | { return __builtin_cosh(__x); } | |
350 | #else | |
351 | inline double _CPP_cosh_capture(double __x) | |
352 | { return cosh(__x); } | |
353 | #endif | |
354 | ||
355 | #if _GLIBCPP_HAVE_BUILTIN_EXP | |
356 | inline double _CPP_exp_capture(double __x) | |
357 | { return __builtin_exp(__x); } | |
358 | #else | |
359 | inline double _CPP_exp_capture(double __x) | |
360 | { return exp(__x); } | |
361 | #endif | |
362 | ||
363 | #if _GLIBCPP_HAVE_BUILTIN_FABS | |
364 | inline double _CPP_fabs_capture(double __x) | |
365 | { return __builtin_fabs(__x); } | |
366 | #else | |
367 | inline double _CPP_fabs_capture(double __x) | |
368 | { return fabs(__x); } | |
369 | #endif | |
370 | ||
371 | #if _GLIBCPP_HAVE_BUILTIN_FLOOR | |
372 | inline double _CPP_floor_capture(double __x) | |
373 | { return __builtin_ffloor(__x); } | |
374 | #else | |
375 | inline double _CPP_floor_capture(double __x) | |
376 | { return floor(__x); } | |
377 | #endif | |
378 | ||
379 | #if _GLIBCPP_HAVE_BUILTIN_FMOD | |
380 | inline double _CPP_fmod_capture(double __x, double __y) | |
381 | { return __builtin_fmod(__x, __y); } | |
382 | #else | |
383 | inline double _CPP_fmod_capture(double __x, double __y) | |
384 | { return fmod(__x, __y); } | |
385 | #endif | |
386 | ||
387 | #if _GLIBCPP_HAVE_BUILTIN_FREXP | |
388 | inline double _CPP_frexp_capture(double __x, int* __exp) | |
389 | { return __builtin_frexp(__x, __exp); } | |
390 | #else | |
391 | inline double _CPP_frexp_capture(double __x, int* __exp) | |
ff2b942e | 392 | { return frexp(__x, __exp); } |
54fa7415 SK |
393 | #endif |
394 | ||
395 | #if _GLIBCPP_HAVE_BUILTIN_LDEXP | |
396 | inline double _CPP_ldexp_capture(double __x, int __exp) | |
397 | { return __builtin_ldexp(__x, __exp); } | |
398 | #else | |
399 | inline double _CPP_ldexp_capture(double __x, int __exp) | |
ff2b942e | 400 | { return ldexp(__x, __exp); } |
54fa7415 SK |
401 | #endif |
402 | ||
403 | #if _GLIBCPP_HAVE_BUILTIN_LOG | |
404 | inline double _CPP_log_capture(double __x) | |
405 | { return __builtin_log(__x); } | |
406 | #else | |
407 | inline double _CPP_log_capture(double __x) | |
408 | { return log(__x); } | |
409 | #endif | |
410 | ||
411 | #if _GLIBCPP_HAVE_BUILTIN_LOG10 | |
412 | inline double _CPP_log10_capture(double __x) | |
413 | { return __builtin_log10(__x); } | |
414 | #else | |
415 | inline double _CPP_log10_capture(double __x) | |
416 | { return log10(__x); } | |
417 | #endif | |
418 | ||
419 | #if _GLIBCPP_HAVE_BUILTIN_MODF | |
420 | inline double _CPP_modf_capture(double __x, double* __iptr) | |
421 | { return __builtin_modf(__x, __iptr); } | |
422 | #else | |
423 | inline double _CPP_modf_capture(double __x, double* __iptr) | |
ff2b942e | 424 | { return modf(__x, __iptr); } |
54fa7415 SK |
425 | #endif |
426 | ||
427 | #if _GLIBCPP_HAVE_BUILTIN_POW | |
428 | inline double _CPP_pow_capture(double __x, double __y) | |
429 | { return __builtin_pow(__x, static_cast<double>(__y)); } | |
430 | #else | |
431 | inline double _CPP_pow_capture(double __x, double __y) | |
ff2b942e | 432 | { return pow(__x, __y); } |
54fa7415 SK |
433 | #endif |
434 | ||
435 | #if _GLIBCPP_HAVE_BUILTIN_SIN | |
436 | inline double _CPP_sin_capture(double __x) | |
437 | { return __builtin_sin(__x); } | |
438 | #else | |
439 | inline double _CPP_sin_capture(double __x) | |
440 | { return sin(__x); } | |
441 | #endif | |
442 | ||
443 | #if _GLIBCPP_HAVE_BUILTIN_SINH | |
444 | inline double _CPP_sinh_capture(double __x) | |
445 | { return __builtin_sinh(__x); } | |
446 | #else | |
447 | inline double _CPP_sinh_capture(double __x) | |
448 | { return sinh(__x); } | |
449 | #endif | |
450 | ||
451 | #if _GLIBCPP_HAVE_BUILTIN_SQRT | |
452 | inline double _CPP_sqrt_capture(double __x) | |
453 | { return __builtin_fsqrt(__x); } | |
454 | #else | |
455 | inline double _CPP_sqrt_capture(double __x) | |
456 | { return sqrt(__x); } | |
457 | #endif | |
458 | ||
459 | #if _GLIBCPP_HAVE_BUILTIN_TAN | |
460 | inline double _CPP_tan_capture(double __x) | |
461 | { return __builtin_tan(__x); } | |
462 | #else | |
463 | inline double _CPP_tan_capture(double __x) | |
464 | { return tan(__x); } | |
465 | #endif | |
466 | ||
467 | #if _GLIBCPP_HAVE_BUILTIN_TANH | |
468 | inline double _CPP_tanh_capture(double __x) | |
469 | { return __builtin_tanh(__x); } | |
470 | #else | |
471 | inline double _CPP_tanh_capture(double __x) | |
472 | { return tanh(__x); } | |
473 | #endif | |
474 | ||
475 | // | |
476 | // long double | |
477 | // | |
478 | ||
479 | #if _GLIBCPP_HAVE_BUILTIN_ACOSL | |
480 | inline long double _CPP_acos_capture(long double __x) | |
481 | { return __builtin_acosl(__x); } | |
482 | #elif _GLIBCPP_HAVE_ACOSL | |
483 | inline long double _CPP_acos_capture(long double __x) | |
484 | { return acosl(__x); } | |
485 | #else | |
486 | inline long double _CPP_acos_capture(long double __x) | |
487 | { return acos(static_cast<double>(__x)); } | |
488 | #endif | |
489 | ||
490 | #if _GLIBCPP_HAVE_BUILTIN_ASINL | |
491 | inline long double _CPP_asin_capture(long double __x) | |
492 | { return __builtin_asinl(__x); } | |
493 | #elif _GLIBCPP_HAVE_ASINL | |
494 | inline long double _CPP_asin_capture(long double __x) | |
495 | { return asinl(__x); } | |
496 | #else | |
497 | inline long double _CPP_asin_capture(long double __x) | |
498 | { return asin(static_cast<double>(__x)); } | |
499 | #endif | |
500 | ||
501 | #if _GLIBCPP_HAVE_BUILTIN_ATANL | |
502 | inline long double _CPP_atan_capture(long double __x) | |
503 | { return __builtin_atanl(__x); } | |
504 | #elif _GLIBCPP_HAVE_ATANL | |
505 | inline long double _CPP_atan_capture(long double __x) | |
506 | { return atanl(__x); } | |
507 | #else | |
508 | inline long double _CPP_atan_capture(long double __x) | |
509 | { return atan(static_cast<double>(__x)); } | |
510 | #endif | |
511 | ||
512 | #if _GLIBCPP_HAVE_BUILTIN_ATAN2L | |
513 | inline long double _CPP_atan2_capture(long double __y, long double __x) | |
514 | { return __builtin_atan2l(__y, __x); } | |
515 | #elif _GLIBCPP_HAVE_ATAN2L | |
516 | inline long double _CPP_atan2_capture(long double __y, long double __x) | |
517 | { return atan2l(__y, __x); } | |
518 | #else | |
519 | inline long double _CPP_atan2_capture(long double __y, long double __x) | |
520 | { return atan2(static_cast<double>(__y), static_cast<double>(__x)); } | |
521 | #endif | |
522 | ||
523 | #if _GLIBCPP_HAVE_BUILTIN_CEILL | |
524 | inline long double _CPP_ceil_capture(long double __x) | |
525 | { return __builtin_ceill(__x); } | |
526 | #elif _GLIBCPP_HAVE_CEILL | |
527 | inline long double _CPP_ceil_capture(long double __x) | |
528 | { return ceill(__x); } | |
529 | #else | |
530 | inline long double _CPP_ceil_capture(long double __x) | |
531 | { return ceil(static_cast<double>(__x)); } | |
532 | #endif | |
533 | ||
534 | #if _GLIBCPP_HAVE_BUILTIN_COSL | |
535 | inline long double _CPP_cos_capture(long double __x) | |
536 | { return __builtin_cosl(__x); } | |
537 | #elif _GLIBCPP_HAVE_COSL | |
538 | inline long double _CPP_cos_capture(long double __x) | |
539 | { return cosl(__x); } | |
540 | #else | |
541 | inline long double _CPP_cos_capture(long double __x) | |
542 | { return cos(static_cast<double>(__x)); } | |
543 | #endif | |
544 | ||
545 | #if _GLIBCPP_HAVE_BUILTIN_COSHL | |
546 | inline long double _CPP_cosh_capture(long double __x) | |
547 | { return __builtin_coshl(__x); } | |
548 | #elif _GLIBCPP_HAVE_COSHL | |
549 | inline long double _CPP_cosh_capture(long double __x) | |
550 | { return coshl(__x); } | |
551 | #else | |
552 | inline long double _CPP_cosh_capture(long double __x) | |
553 | { return cosh(static_cast<double>(__x)); } | |
554 | #endif | |
555 | ||
556 | #if _GLIBCPP_HAVE_BUILTIN_EXPL | |
557 | inline long double _CPP_exp_capture(long double __x) | |
558 | { return __builtin_expl(__x); } | |
559 | #elif _GLIBCPP_HAVE_EXPL | |
560 | inline long double _CPP_exp_capture(long double __x) | |
561 | { return expl(__x); } | |
562 | #else | |
563 | inline long double _CPP_exp_capture(long double __x) | |
564 | { return exp(static_cast<double>(__x)); } | |
565 | #endif | |
566 | ||
567 | #if _GLIBCPP_HAVE_BUILTIN_FABSL | |
568 | inline long double _CPP_fabs_capture(long double __x) | |
569 | { return __builtin_fabsl(__x); } | |
570 | #elif _GLIBCPP_HAVE_FABSL | |
571 | inline long double _CPP_fabs_capture(long double __x) | |
572 | { return fabsl(__x); } | |
573 | #else | |
574 | inline long double _CPP_fabs_capture(long double __x) | |
575 | { return fabs(static_cast<double>(__x)); } | |
576 | #endif | |
577 | ||
578 | #if _GLIBCPP_HAVE_BUILTIN_FLOORL | |
579 | inline long double _CPP_floor_capture(long double __x) | |
580 | { return __builtin_floorl(__x); } | |
581 | #elif _GLIBCPP_HAVE_FLOORL | |
582 | inline long double _CPP_floor_capture(long double __x) | |
583 | { return floorl(__x); } | |
584 | #else | |
585 | inline long double _CPP_floor_capture(long double __x) | |
586 | { return floor(static_cast<double>(__x)); } | |
587 | #endif | |
588 | ||
589 | #if _GLIBCPP_HAVE_BUILTIN_FMODL | |
590 | inline long double _CPP_fmod_capture(long double __x, long double __y) | |
591 | { return __builtin_fmodl(__x, __y); } | |
592 | #elif _GLIBCPP_HAVE_FMODL | |
593 | inline long double _CPP_fmod_capture(long double __x, long double __y) | |
594 | { return fmodl(__x, __y); } | |
595 | #else | |
596 | inline long double _CPP_fmod_capture(long double __x, long double __y) | |
597 | { return fmod(static_cast<double>(__x), static_cast<double>(__y)); } | |
598 | #endif | |
599 | ||
600 | #if _GLIBCPP_HAVE_BUILTIN_FREXPL | |
601 | inline long double _CPP_frexp_capture(long double __x, int* __exp) | |
602 | { return __builtin_frexpl(__x, __exp); } | |
603 | #elif _GLIBCPP_HAVE_FREXPL | |
604 | inline long double _CPP_frexp_capture(long double __x, int* __exp) | |
605 | { return frexpl(__x, __exp); } | |
606 | #else | |
607 | inline long double _CPP_frexp_capture(long double __x, int* __exp) | |
608 | { return frexp(static_cast<double>(__x), __exp); } | |
609 | #endif | |
610 | ||
611 | #if _GLIBCPP_HAVE_BUILTIN_LDEXPL | |
612 | inline long double _CPP_ldexp_capture(long double __x, int __exp) | |
613 | { return __builtin_ldexpl(__x, __exp); } | |
614 | #elif _GLIBCPP_HAVE_LDEXPL | |
615 | inline long double _CPP_ldexp_capture(long double __x, int __exp) | |
616 | { return ldexpl(__x, __exp); } | |
617 | #else | |
618 | inline long double _CPP_ldexp_capture(long double __x, int __exp) | |
619 | { return ldexp(static_cast<double>(__x), __exp); } | |
620 | #endif | |
621 | ||
622 | #if _GLIBCPP_HAVE_BUILTIN_LOGL | |
623 | inline long double _CPP_log_capture(long double __x) | |
624 | { return __builtin_logl(__x); } | |
625 | #elif _GLIBCPP_HAVE_LOGL | |
626 | inline long double _CPP_log_capture(long double __x) | |
627 | { return logl(__x); } | |
628 | #else | |
629 | inline long double _CPP_log_capture(long double __x) | |
630 | { return log(static_cast<double>(__x)); } | |
631 | #endif | |
632 | ||
633 | #if _GLIBCPP_HAVE_BUILTIN_LOG10L | |
634 | inline long double _CPP_log10_capture(long double __x) | |
635 | { return __builtin_log10l(__x); } | |
636 | #elif _GLIBCPP_HAVE_LOG10L | |
637 | inline long double _CPP_log10_capture(long double __x) | |
638 | { return log10l(__x); } | |
639 | #else | |
640 | inline long double _CPP_log10_capture(long double __x) | |
641 | { return log10(static_cast<double>(__x)); } | |
642 | #endif | |
643 | ||
644 | #if _GLIBCPP_HAVE_BUILTIN_MODFL | |
645 | inline long double _CPP_mod_capture(long double __x, long double* __iptr) | |
646 | { return __builtin_modfl(__x, __iptr); } | |
647 | #elif _GLIBCPP_HAVE_MODFL | |
648 | inline long double _CPP_modf_capture(long double __x, long double* __iptr) | |
649 | { return modfl(__x, __iptr); } | |
650 | #else | |
651 | inline long double _CPP_modf_capture(long double __x, long double* __iptr) | |
652 | { | |
653 | double __tmp; | |
654 | double __res = _C_legacy::modf(static_cast<double>(__x), &__tmp); | |
655 | *__iptr = static_cast<long double> (__tmp); | |
656 | return __res; | |
657 | } | |
658 | #endif | |
659 | ||
660 | #if _GLIBCPP_HAVE_BUILTIN_POWL | |
661 | inline long double _CPP_pow_capture(long double __x, long double __y) | |
662 | { return __builtin_powl(__x, __y); } | |
663 | #elif _GLIBCPP_HAVE_POWL | |
664 | inline long double _CPP_pow_capture(long double __x, long double __y) | |
665 | { return powl(__x, __y); } | |
666 | #else | |
667 | inline long double _CPP_pow_capture(long double __x, long double __y) | |
668 | { return pow(static_cast<double>(__x), static_cast<double>(__y)); } | |
669 | #endif | |
670 | ||
671 | #if _GLIBCPP_HAVE_BUILTIN_SINL | |
672 | inline long double _CPP_sin_capture(long double __x) | |
673 | { return __builtin_sinl(__x); } | |
674 | #elif _GLIBCPP_HAVE_SINL | |
675 | inline long double _CPP_sin_capture(long double __x) | |
676 | { return sinl(__x); } | |
677 | #else | |
678 | inline long double _CPP_sin_capture(long double __x) | |
679 | { return sin(static_cast<double>(__x)); } | |
680 | #endif | |
681 | ||
682 | #if _GLIBCPP_HAVE_BUILTIN_SINHL | |
683 | inline long double _CPP_sinh_capture(long double __x) | |
684 | { return __builtin_sinhl(__x); } | |
685 | #elif _GLIBCPP_HAVE_SINHL | |
686 | inline long double _CPP_sinh_capture(long double __x) | |
687 | { return sinhl(__x); } | |
688 | #else | |
689 | inline long double _CPP_sinh_capture(long double __x) | |
690 | { return sinh(static_cast<double>(__x)); } | |
691 | #endif | |
692 | ||
693 | #if _GLIBCPP_HAVE_BUILTIN_SQRTL | |
694 | inline long double _CPP_sqrt_capture(long double __x) | |
695 | { return __builtin_sqrtl(__x); } | |
696 | #elif _GLIBCPP_HAVE_SQRTL | |
697 | inline long double _CPP_sqrt_capture(long double __x) | |
698 | { return sqrtl(__x); } | |
699 | #else | |
700 | inline long double _CPP_sqrt_capture(long double __x) | |
701 | { return sqrt(static_cast<double>(__x)); } | |
702 | #endif | |
703 | ||
704 | #if _GLIBCPP_HAVE_BUILTIN_TANL | |
705 | inline long double _CPP_tan_capture(long double __x) | |
706 | { return __builtin_tanl(__x); } | |
707 | #elif _GLIBCPP_HAVE_TANL | |
708 | inline long double _CPP_tan_capture(long double __x) | |
709 | { return tanl(__x); } | |
710 | #else | |
711 | inline long double _CPP_tan_capture(long double __x) | |
712 | { return tan(static_cast<double>(__x)); } | |
713 | #endif | |
714 | ||
715 | #if _GLIBCPP_HAVE_BUILTIN_TANHL | |
716 | inline long double _CPP_tanh_capture(long double __x) | |
717 | { return __builtin_tanhl(__x); } | |
718 | #elif _GLIBCPP_HAVE_TANHL | |
719 | inline long double _CPP_tanh_capture(long double __x) | |
720 | { return tanhl(__x); } | |
721 | #else | |
722 | inline long double _CPP_tanh_capture(long double __x) | |
723 | { return tanh(static_cast<double>(__x)); } | |
724 | #endif | |
725 | ||
ff2b942e | 726 | |
6dad70df BK |
727 | namespace _C_shadow { } |
728 | } // close namespace ::_C_legacy:: | |
ff2b942e BK |
729 | |
730 | # undef HUGE_VAL | |
6dad70df | 731 | # define HUGE_VAL ::_C_legacy::_CPP_HUGE_VAL_capture() |
54fa7415 | 732 | # undef abs |
ff2b942e BK |
733 | # undef acos |
734 | # undef asin | |
735 | # undef atan | |
736 | # undef atan2 | |
54fa7415 | 737 | # undef ceil |
ff2b942e | 738 | # undef cos |
ff2b942e | 739 | # undef cosh |
ff2b942e | 740 | # undef exp |
54fa7415 SK |
741 | # undef fabs |
742 | # undef floor | |
743 | # undef fmod | |
ff2b942e BK |
744 | # undef frexp |
745 | # undef ldexp | |
746 | # undef log | |
747 | # undef log10 | |
748 | # undef modf | |
749 | # undef pow | |
54fa7415 SK |
750 | # undef sin |
751 | # undef sinh | |
ff2b942e | 752 | # undef sqrt |
54fa7415 SK |
753 | # undef tan |
754 | # undef tanh | |
ff2b942e | 755 | |
6dad70df BK |
756 | namespace _C_legacy { |
757 | namespace _C_shadow { | |
ff2b942e BK |
758 | } |
759 | } | |
760 | namespace std { | |
761 | ||
54fa7415 SK |
762 | // |
763 | // float | |
764 | // | |
765 | ||
766 | inline float abs(float __x) | |
767 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
768 | ||
769 | inline float acos(float __x) | |
770 | { return ::_C_legacy::_CPP_acos_capture(__x); } | |
771 | ||
772 | inline float asin(float __x) | |
773 | { return ::_C_legacy::_CPP_asin_capture(__x); } | |
774 | ||
775 | inline float atan(float __x) | |
776 | { return ::_C_legacy::_CPP_atan_capture(__x); } | |
777 | ||
778 | inline float atan2(float __y, float __x) | |
779 | { return ::_C_legacy::_CPP_atan2_capture(__y, __x); } | |
780 | ||
781 | inline float ceil(float __x) | |
782 | { return ::_C_legacy::_CPP_ceil_capture(__x); } | |
783 | ||
784 | inline float cos(float __x) | |
785 | { return ::_C_legacy::_CPP_cos_capture(__x); } | |
786 | ||
787 | inline float cosh(float __x) | |
788 | { return ::_C_legacy::_CPP_cosh_capture(__x); } | |
789 | ||
790 | inline float exp(float __x) | |
791 | { return ::_C_legacy::_CPP_exp_capture(__x); } | |
792 | ||
793 | inline float fabs(float __x) | |
794 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
795 | ||
796 | inline float floor(float __x) | |
797 | { return ::_C_legacy::_CPP_floor_capture(__x); } | |
798 | ||
799 | inline float fmod(float __x, float __y) | |
800 | { return ::_C_legacy::_CPP_fmod_capture(__x, __y); } | |
801 | ||
802 | inline float frexp(float __x, int* __exp) | |
803 | { return ::_C_legacy::_CPP_frexp_capture(__x, __exp); } | |
804 | ||
805 | inline float ldexp(float __x, int __exp) | |
806 | { return ::_C_legacy::_CPP_ldexp_capture(__x, __exp); } | |
807 | ||
808 | inline float log(float __x) | |
809 | { return ::_C_legacy::_CPP_log_capture(__x); } | |
810 | ||
811 | inline float log10(float __x) | |
812 | { return ::_C_legacy::_CPP_log10_capture(__x); } | |
813 | ||
814 | inline float modf(float __x, float* __iptr) | |
815 | { return ::_C_legacy::_CPP_modf_capture(__x, __iptr); } | |
816 | ||
817 | inline float pow(float __x, float __y) | |
818 | { return ::_C_legacy::_CPP_pow_capture(__x, __y); } | |
819 | ||
820 | float pow(float, int); | |
821 | ||
822 | inline float sin(float __x) | |
823 | { return ::_C_legacy::_CPP_sin_capture(__x); } | |
824 | ||
825 | inline float sinh(float __x) | |
826 | { return ::_C_legacy::_CPP_sinh_capture(__x); } | |
827 | ||
828 | inline float sqrt(float __x) | |
829 | { return ::_C_legacy::_CPP_sqrt_capture(__x); } | |
830 | ||
831 | inline float tan(float __x) | |
832 | { return ::_C_legacy::_CPP_tan_capture(__x); } | |
833 | ||
834 | inline float tanh(float __x) | |
835 | { return ::_C_legacy::_CPP_tanh_capture(__x); } | |
836 | ||
837 | // | |
838 | // double | |
839 | // | |
840 | ||
841 | inline double abs(double __x) | |
842 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
843 | ||
844 | inline double acos(double __x) | |
845 | { return ::_C_legacy::_CPP_acos_capture(__x); } | |
846 | ||
847 | inline double asin(double __x) | |
848 | { return ::_C_legacy::_CPP_asin_capture(__x); } | |
849 | ||
850 | inline double atan(double __x) | |
851 | { return ::_C_legacy::_CPP_atan_capture(__x); } | |
852 | ||
853 | inline double atan2(double __y, double __x) | |
854 | { return ::_C_legacy::_CPP_atan2_capture(__y, __x); } | |
855 | ||
856 | inline double ceil(double __x) | |
857 | { return ::_C_legacy::_CPP_ceil_capture(__x); } | |
858 | ||
859 | inline double cos(double __x) | |
860 | { return ::_C_legacy::_CPP_cos_capture(__x); } | |
861 | ||
862 | inline double cosh(double __x) | |
863 | { return ::_C_legacy::_CPP_cosh_capture(__x); } | |
864 | ||
865 | inline double exp(double __x) | |
866 | { return ::_C_legacy::_CPP_exp_capture(__x); } | |
867 | ||
868 | inline double fabs(double __x) | |
869 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
870 | ||
871 | inline double floor(double __x) | |
872 | { return ::_C_legacy::_CPP_floor_capture(__x); } | |
873 | ||
874 | inline double fmod(double __x, double __y) | |
875 | { return ::_C_legacy::_CPP_fmod_capture(__x, __y); } | |
876 | ||
877 | inline double frexp(double __x, int* __exp) | |
878 | { return ::_C_legacy::_CPP_frexp_capture(__x, __exp); } | |
879 | ||
880 | inline double ldexp(double __x, int __exp) | |
881 | { return ::_C_legacy::_CPP_ldexp_capture(__x, __exp); } | |
882 | ||
883 | inline double log(double __x) | |
884 | { return ::_C_legacy::_CPP_log_capture(__x); } | |
885 | ||
886 | inline double log10(double __x) | |
887 | { return ::_C_legacy::_CPP_log10_capture(__x); } | |
888 | ||
889 | inline double modf(double __x, double* __iptr) | |
890 | { return ::_C_legacy::_CPP_modf_capture(__x, __iptr); } | |
891 | ||
892 | inline double pow(double __x, double __y) | |
893 | { return ::_C_legacy::_CPP_pow_capture(__x, __y); } | |
894 | ||
895 | double pow (double, int); | |
896 | ||
897 | inline double sin(double __x) | |
898 | { return ::_C_legacy::_CPP_sin_capture(__x); } | |
899 | ||
900 | inline double sinh(double __x) | |
901 | { return ::_C_legacy::_CPP_sinh_capture(__x); } | |
902 | ||
903 | inline double sqrt(double __x) | |
904 | { return ::_C_legacy::_CPP_sqrt_capture(__x); } | |
905 | ||
906 | inline double tan(double __x) | |
907 | { return ::_C_legacy::_CPP_tan_capture(__x); } | |
908 | ||
909 | inline double tanh(double __x) | |
910 | { return ::_C_legacy::_CPP_tanh_capture(__x); } | |
911 | ||
912 | // | |
913 | // long double | |
914 | // | |
915 | inline long double abs(long double __x) | |
916 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
917 | ||
918 | inline long double acos(long double __x) | |
919 | { return ::_C_legacy::_CPP_acos_capture(__x); } | |
920 | ||
921 | inline long double asin(long double __x) | |
922 | { return ::_C_legacy::_CPP_asin_capture(__x); } | |
923 | ||
924 | inline long double atan(long double __x) | |
925 | { return ::_C_legacy::_CPP_atan_capture(__x); } | |
926 | ||
927 | inline long double atan2(long double __y, long double __x) | |
928 | { return ::_C_legacy::_CPP_atan2_capture(__y, __x); } | |
929 | ||
930 | inline long double ceil(long double __x) | |
931 | { return ::_C_legacy::_CPP_ceil_capture(__x); } | |
932 | ||
933 | inline long double cos(long double __x) | |
934 | { return ::_C_legacy::_CPP_cos_capture(__x); } | |
935 | ||
936 | inline long double cosh(long double __x) | |
937 | { return ::_C_legacy::_CPP_cosh_capture(__x); } | |
938 | ||
939 | inline long double exp(long double __x) | |
940 | { return ::_C_legacy::_CPP_exp_capture(__x); } | |
941 | ||
942 | inline long double fabs(long double __x) | |
943 | { return ::_C_legacy::_CPP_fabs_capture(__x); } | |
944 | ||
945 | inline long double floor(long double __x) | |
946 | { return ::_C_legacy::_CPP_floor_capture(__x); } | |
947 | ||
948 | inline long double fmod(long double __x, long double __y) | |
949 | { return ::_C_legacy::_CPP_fmod_capture(__x, __y); } | |
950 | ||
951 | inline long double frexp(long double __x, int* __exp) | |
952 | { return ::_C_legacy::_CPP_frexp_capture(__x, __exp); } | |
953 | ||
954 | inline long double ldexp(long double __x, int __exp) | |
955 | { return ::_C_legacy::_CPP_ldexp_capture(__x, __exp); } | |
956 | ||
957 | inline long double log(long double __x) | |
958 | { return ::_C_legacy::_CPP_log_capture(__x); } | |
959 | ||
960 | inline long double log10(long double __x) | |
961 | { return ::_C_legacy::_CPP_log10_capture(__x); } | |
962 | ||
963 | inline long double modf(long double __x, long double* __iptr) | |
964 | { return ::_C_legacy::_CPP_modf_capture(__x, __iptr); } | |
965 | ||
966 | inline long double pow(long double __x, long double __y) | |
967 | { return ::_C_legacy::_CPP_pow_capture(__x, __y); } | |
968 | ||
969 | long double pow (long double, int); | |
970 | ||
971 | inline long double sin(long double __x) | |
972 | { return ::_C_legacy::_CPP_sin_capture(__x); } | |
973 | ||
974 | inline long double sinh(long double __x) | |
975 | { return ::_C_legacy::_CPP_sinh_capture(__x); } | |
976 | ||
977 | inline long double sqrt(long double __x) | |
978 | { return ::_C_legacy::_CPP_sqrt_capture(__x); } | |
979 | ||
980 | inline long double tan(long double __x) | |
981 | { return ::_C_legacy::_CPP_tan_capture(__x); } | |
982 | ||
983 | inline long double tanh(long double __x) | |
984 | { return ::_C_legacy::_CPP_tanh_capture(__x); } | |
985 | ||
ff2b942e BK |
986 | |
987 | } // close namespace std:: | |
988 | ||
6dad70df BK |
989 | namespace _C_legacy { |
990 | namespace _C_shadow { | |
ff2b942e BK |
991 | } |
992 | } | |
993 | ||
6dad70df | 994 | # undef _IN_C_LEGACY_ |
ff2b942e BK |
995 | |
996 | #endif |