1 // -*- C++ -*- header wrapper.
3 // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.
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)
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.
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,
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.
31 // ISO C++ 14882: 26.5 C library
37 # include <bits/c++config.h>
41 # define _IN_C_LEGACY_
42 # pragma GCC system_header
43 # include_next <math.h>
46 #if _GLIBCPP_HAVE_ACOSF
48 _CPP_acos_capture(float __x
) { return acosf(__x
); }
51 _CPP_acos_capture(float __x
) { return acos(static_cast<double>(__x
)); }
54 #if _GLIBCPP_HAVE_ASINF
56 _CPP_asin_capture(float __x
) { return asinf(__x
); }
59 _CPP_asin_capture(float __x
) { return asin(static_cast<double>(__x
)); }
62 #if _GLIBCPP_HAVE_ATANF
64 _CPP_atan_capture(float __x
) { return atanf(__x
); }
67 _CPP_atan_capture(float __x
) { return atan(static_cast<double>(__x
)); }
70 #if _GLIBCPP_HAVE_ATAN2F
72 _CPP_atan2_capture(float __y
, float __x
) { return atan2f(__y
, __x
); }
75 _CPP_atan2_capture(float __y
, float __x
)
76 { return atan2(static_cast<double>(__y
), static_cast<double>(__x
)); }
79 #if _GLIBCPP_HAVE_CEILF
81 _CPP_ceil_capture(float __x
) { return ceilf(__x
); }
84 _CPP_ceil_capture(float __x
) { return ceil(static_cast<double>(__x
)); }
87 #if _GLIBCPP_HAVE___BUILTIN_COSF
89 _CPP_cos_capture(float __x
) { return __builtin_cosf(__x
); }
90 #elif _GLIBCPP_HAVE_COSF
92 _CPP_cos_capture(float __x
) { return cosf(__x
); }
95 _CPP_cos_capture(float __x
) { return cos(static_cast<double>(__x
)); }
98 #if _GLIBCPP_HAVE_COSHF
100 _CPP_cosh_capture(float __x
) { return coshf(__x
); }
103 _CPP_cosh_capture(float __x
) { return cosh(static_cast<double>(__x
)); }
106 #if _GLIBCPP_HAVE_EXPF
108 _CPP_exp_capture(float __x
) { return expf(__x
); }
111 _CPP_exp_capture(float __x
) { return exp(static_cast<double>(__x
)); }
114 #if _GLIBCPP_HAVE___BUILTIN_FABSF
116 _CPP_fabs_capture(float __x
) { return __builtin_fabsf(__x
); }
117 #elif _GLIBCPP_HAVE_FABSF
119 _CPP_fabs_capture(float __x
) { return fabsf(__x
); }
122 _CPP_fabs_capture(float __x
) { return fabs(static_cast<double>(__x
)); }
125 #if _GLIBCPP_HAVE_FLOORF
127 _CPP_floor_capture(float __x
) { return floorf(__x
); }
130 _CPP_floor_capture(float __x
) { return floor(static_cast<double>(__x
)); }
133 #if _GLIBCPP_HAVE_FMODFF
135 _CPP_fmod_capture(float __x
, float __y
) { return fmodf(__x
, __y
); }
138 _CPP_fmod_capture(float __x
, float __y
)
139 { return fmod(static_cast<double>(__x
), static_cast<double>(__y
)); }
142 #if _GLIBCPP_HAVE_FREXPF
144 _CPP_frexp_capture(float __x
, int* __exp
) { return frexpf(__x
, __exp
); }
147 _CPP_frexp_capture(float __x
, int* __exp
) { return frexp(__x
, __exp
); }
150 #if _GLIBCPP_HAVE_LDEXPF
152 _CPP_ldexp_capture(float __x
, int __exp
) { return ldexpf(__x
, __exp
); }
155 _CPP_ldexp_capture(float __x
, int __exp
)
156 { return ldexp(static_cast<double>(__x
), __exp
); }
159 #if _GLIBCPP_HAVE_LOGF
161 _CPP_log_capture(float __x
) { return logf(__x
); }
164 _CPP_log_capture(float __x
) { return log(static_cast<double>(__x
)); }
167 #if _GLIBCPP_HAVE_LOG10F
169 _CPP_log10_capture(float __x
) { return log10f(__x
); }
172 _CPP_log10_capture(float __x
) { return log10(static_cast<double>(__x
)); }
175 #if _GLIBCPP_HAVE_MODFF
177 _CPP_modf_capture(float __x
, float* __iptr
) { return modff(__x
, __iptr
); }
180 _CPP_modf_capture(float __x
, float* __iptr
)
183 double __res
= _C_legacy::modf(static_cast<double>(__x
), &__tmp
);
184 *__iptr
= static_cast<float> (__tmp
);
189 #if _GLIBCPP_HAVE_POWF
191 _CPP_pow_capture(float __x
, float __y
) { return powf(__x
, __y
); }
194 _CPP_pow_capture(float __x
, float __y
)
195 { return pow(static_cast<double>(__x
), static_cast<double>(__y
)); }
198 float pow(float, int);
200 #if _GLIBCPP_HAVE___BUILTIN_SINF
202 _CPP_sin_capture(float __x
) { return __builtin_sinf(__x
); }
203 #elif _GLIBCPP_HAVE_SINF
205 _CPP_sin_capture(float __x
) { return sinf(__x
); }
208 _CPP_sin_capture(float __x
) { return sin(static_cast<double>(__x
)); }
211 #if _GLIBCPP_HAVE_SINHF
213 _CPP_sinh_capture(float __x
) { return sinhf(__x
); }
216 _CPP_sinh_capture(float __x
) { return sinh(static_cast<double>(__x
)); }
219 #if _GLIBCPP_HAVE___BUILTIN_SQRTF
221 _CPP_sqrt_capture(float __x
) { return __builtin_sqrtf(__x
); }
222 #elif _GLIBCPP_HAVE_SQRTF
224 _CPP_sqrt_capture(float __x
) { return sqrtf(__x
); }
227 _CPP_sqrt_capture(float __x
) { return sqrt(static_cast<double>(__x
)); }
230 #if _GLIBCPP_HAVE_TANF
232 _CPP_tan_capture(float __x
) { return tanf(__x
); }
235 _CPP_tan_capture(float __x
) { return tan(static_cast<double>(__x
)); }
238 #if _GLIBCPP_HAVE_TANHF
240 _CPP_tanh_capture(float __x
) { return tanhf(__x
); }
243 _CPP_tanh_capture(float __x
) { return tanh(static_cast<double>(__x
)); }
248 _CPP_acos_capture(double __x
) { return acos(__x
); }
251 _CPP_asin_capture(double __x
) { return asin(__x
); }
254 _CPP_atan_capture(double __x
) { return atan(__x
); }
257 _CPP_atan2_capture(double __y
, double __x
) { return atan2(__y
, __x
); }
260 _CPP_ceil_capture(double __x
) { return ceil(__x
); }
262 #if _GLIBCPP_HAVE___BUILTIN_COS
264 _CPP_cos_capture(double __x
) { return __builtin_cos(__x
); }
267 _CPP_cos_capture(double __x
) { return cos(__x
); }
271 _CPP_cosh_capture(double __x
) { return cosh(__x
); }
274 _CPP_exp_capture(double __x
) { return exp(__x
); }
276 #if _GLIBCPP_HAVE___BUILTIN_FABS
278 _CPP_fabs_capture(double __x
) { return __builtin_fabs(__x
); }
281 _CPP_fabs_capture(double __x
) { return fabs(__x
); }
285 _CPP_floor_capture(double __x
) { return floor(__x
); }
288 _CPP_fmod_capture(double __x
, double __y
) { return fmod(__x
, __y
); }
291 _CPP_frexp_capture(double __x
, int* __exp
) { return frexp(__x
, __exp
); }
294 _CPP_ldexp_capture(double __x
, int __exp
) { return ldexp(__x
, __exp
); }
297 _CPP_log_capture(double __x
) { return log(__x
); }
300 _CPP_log10_capture(double __x
) { return log10(__x
); }
303 _CPP_modf_capture(double __x
, double* __iptr
) { return modf(__x
, __iptr
); }
306 _CPP_pow_capture(double __x
, double __y
) { return pow(__x
, __y
); }
308 #if _GLIBCPP_HAVE___BUILTIN_SIN
310 _CPP_sin_capture(double __x
) { return __builtin_sin(__x
); }
313 _CPP_sin_capture(double __x
) { return sin(__x
); }
317 _CPP_sinh_capture(double __x
) { return sinh(__x
); }
319 #if _GLIBCPP_HAVE___BUILTIN_SQRT
321 _CPP_sqrt_capture(double __x
) { return __builtin_fsqrt(__x
); }
324 _CPP_sqrt_capture(double __x
) { return sqrt(__x
); }
328 _CPP_tan_capture(double __x
) { return tan(__x
); }
331 _CPP_tanh_capture(double __x
) { return tanh(__x
); }
333 #if _GLIBCPP_HAVE_ACOSL
335 _CPP_acos_capture(long double __x
) { return acosl(__x
); }
338 _CPP_acos_capture(long double __x
) { return acos(static_cast<double>(__x
)); }
341 #if _GLIBCPP_HAVE_ASINL
343 _CPP_asin_capture(long double __x
) { return asinl(__x
); }
346 _CPP_asin_capture(long double __x
) { return asin(static_cast<double>(__x
)); }
349 #if _GLIBCPP_HAVE_ATANL
351 _CPP_atan_capture(long double __x
) { return atanl(__x
); }
354 _CPP_atan_capture(long double __x
) { return atan(static_cast<double>(__x
)); }
357 #if _GLIBCPP_HAVE_ATAN2L
359 _CPP_atan2_capture(long double __y
, long double __x
)
360 { return atan2l(__y
, __x
); }
363 _CPP_atan2_capture(long double __y
, long double __x
)
364 { return atan2(static_cast<double>(__y
), static_cast<double>(__x
)); }
367 #if _GLIBCPP_HAVE_CEILL
369 _CPP_ceil_capture(long double __x
) { return ceill(__x
); }
372 _CPP_ceil_capture(long double __x
) { return ceil(static_cast<double>(__x
)); }
375 #if _GLIBCPP_HAVE___BUILTIN_COSL
377 _CPP_cos_capture(long double __x
) { return __builtin_cosl(__x
); }
378 #elif _GLIBCPP_HAVE_COSL
380 _CPP_cos_capture(long double __x
) { return cosl(__x
); }
383 _CPP_cos_capture(long double __x
) { return cos(static_cast<double>(__x
)); }
386 #if _GLIBCPP_HAVE_COSHL
388 _CPP_cosh_capture(long double __x
) { return coshl(__x
); }
391 _CPP_cosh_capture(long double __x
) { return cosh(static_cast<double>(__x
)); }
394 #if _GLIBCPP_HAVE_EXPL
396 _CPP_exp_capture(long double __x
) { return expl(__x
); }
399 _CPP_exp_capture(long double __x
) { return exp(static_cast<double>(__x
)); }
402 #if _GLIBCPP_HAVE___BUILTIN_FABSL
404 _CPP_fabs_capture(long double __x
) { return __builtin_fabsl(__x
); }
405 #elif _GLIBCPP_HAVE_FABSL
407 _CPP_fabs_capture(long double __x
) { return fabsl(__x
); }
410 _CPP_fabs_capture(long double __x
) { return fabs(static_cast<double>(__x
)); }
413 #if _GLIBCPP_HAVE_FLOORL
415 _CPP_floor_capture(long double __x
) { return floorl(__x
); }
418 _CPP_floor_capture(long double __x
)
419 { return floor(static_cast<double>(__x
)); }
422 #if _GLIBCPP_HAVE_FMODL
424 _CPP_fmod_capture(long double __x
, long double __y
)
425 { return fmodl(__x
, __y
); }
428 _CPP_fmod_capture(long double __x
, long double __y
)
429 { return fmod(static_cast<double>(__x
), static_cast<double>(__y
)); }
432 #if _GLIBCPP_HAVE_FREXPL
434 _CPP_frexp_capture(long double __x
, int* __exp
)
435 { return frexpl(__x
, __exp
); }
438 _CPP_frexp_capture(long double __x
, int* __exp
)
439 { return frexp(static_cast<double>(__x
), __exp
); }
442 #if _GLIBCPP_HAVE_LDEXPL
444 _CPP_ldexp_capture(long double __x
, int __exp
) { return ldexpl(__x
, __exp
); }
447 _CPP_ldexp_capture(long double __x
, int __exp
)
448 { return ldexp(static_cast<double>(__x
), __exp
); }
451 #if _GLIBCPP_HAVE_LOGL
453 _CPP_log_capture(long double __x
) { return logl(__x
); }
456 _CPP_log_capture(long double __x
) { return log(static_cast<double>(__x
)); }
459 #if _GLIBCPP_HAVE_LOG10L
461 _CPP_log10_capture(long double __x
) { return log10l(__x
); }
464 _CPP_log10_capture(long double __x
)
465 { return log10(static_cast<double>(__x
)); }
468 #if _GLIBCPP_HAVE_MODFL
470 _CPP_modf_capture(long double __x
, long double* __iptr
)
471 { return modfl(__x
, __iptr
); }
474 _CPP_modf_capture(long double __x
, long double* __iptr
)
477 double __res
= _C_legacy::modf(static_cast<double>(__x
), &__tmp
);
478 *__iptr
= static_cast<long double> (__tmp
);
483 #if _GLIBCPP_HAVE_POWL
485 _CPP_pow_capture(long double __x
, long double __y
) { return powl(__x
, __y
); }
488 _CPP_pow_capture(long double __x
, long double __y
)
489 { return pow(static_cast<double>(__x
), static_cast<double>(__y
)); }
492 #if _GLIBCPP_HAVE___BUILTIN_SINL
494 _CPP_sin_capture(long double __x
) { return __builtin_sinl(__x
); }
495 #elif _GLIBCPP_HAVE_SINL
497 _CPP_sin_capture(long double __x
) { return sinl(__x
); }
500 _CPP_sin_capture(long double __x
) { return sin(static_cast<double>(__x
)); }
503 #if _GLIBCPP_HAVE_SINHL
505 _CPP_sinh_capture(long double __x
) { return sinhl(__x
); }
508 _CPP_sinh_capture(long double __x
) { return sinh(static_cast<double>(__x
)); }
511 #if _GLIBCPP_HAVE___BUILTIN_SQRTL
513 _CPP_sqrt_capture(long double __x
) { return __builtin_sqrtl(__x
); }
514 #elif _GLIBCPP_HAVE_SQRTL
516 _CPP_sqrt_capture(long double __x
) { return sqrtl(__x
); }
519 _CPP_sqrt_capture(long double __x
) { return sqrt(static_cast<double>(__x
)); }
522 #if _GLIBCPP_HAVE_TANL
524 _CPP_tan_capture(long double __x
) { return tanl(__x
); }
527 _CPP_tan_capture(long double __x
) { return tan(static_cast<double>(__x
)); }
530 #if _GLIBCPP_HAVE_TANHL
532 _CPP_tanh_capture(long double __x
) { return tanhl(__x
); }
535 _CPP_tanh_capture(long double __x
) { return tanh(static_cast<double>(__x
)); }
537 } // namespace _C_legacy
565 abs(float __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
568 acos(float __x
) { return _C_legacy::_CPP_acos_capture(__x
); }
571 asin(float __x
) { return _C_legacy::_CPP_asin_capture(__x
); }
574 atan(float __x
) { return _C_legacy::_CPP_atan_capture(__x
); }
577 atan2(float __y
, float __x
)
578 { return _C_legacy::_CPP_atan2_capture(__y
, __x
); }
581 ceil(float __x
) { return _C_legacy::_CPP_ceil_capture(__x
); }
584 cos(float __x
) { return _C_legacy::_CPP_cos_capture(__x
); }
587 cosh(float __x
) { return _C_legacy::_CPP_cosh_capture(__x
); }
590 exp(float __x
) { return _C_legacy::_CPP_exp_capture(__x
); }
593 fabs(float __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
596 floor(float __x
) { return _C_legacy::_CPP_floor_capture(__x
); }
599 fmod(float __x
, float __y
)
600 { return _C_legacy::_CPP_fmod_capture(__x
, __y
); }
603 frexp(float __x
, int* __exp
)
604 { return _C_legacy::_CPP_frexp_capture(__x
, __exp
); }
607 ldexp(float __x
, int __exp
)
608 { return _C_legacy::_CPP_ldexp_capture(__x
, __exp
); }
611 log(float __x
) { return _C_legacy::_CPP_log_capture(__x
); }
614 log10(float __x
) { return _C_legacy::_CPP_log10_capture(__x
); }
617 modf(float __x
, float* __iptr
)
618 { return _C_legacy::_CPP_modf_capture(__x
, __iptr
); }
621 pow(float __x
, float __y
) { return _C_legacy::_CPP_pow_capture(__x
, __y
); }
627 sin(float __x
) { return _C_legacy::_CPP_sin_capture(__x
); }
630 sinh(float __x
) { return _C_legacy::_CPP_sinh_capture(__x
); }
633 sqrt(float __x
) { return _C_legacy::_CPP_sqrt_capture(__x
); }
636 tan(float __x
) { return _C_legacy::_CPP_tan_capture(__x
); }
639 tanh(float __x
) { return _C_legacy::_CPP_tanh_capture(__x
); }
642 abs(double __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
645 acos(double __x
) { return _C_legacy::_CPP_acos_capture(__x
); }
648 asin(double __x
) { return _C_legacy::_CPP_asin_capture(__x
); }
651 atan(double __x
) { return _C_legacy::_CPP_atan_capture(__x
); }
654 atan2(double __y
, double __x
)
655 { return _C_legacy::_CPP_atan2_capture(__y
, __x
); }
658 ceil(double __x
) { return _C_legacy::_CPP_ceil_capture(__x
); }
661 cos(double __x
) { return _C_legacy::_CPP_cos_capture(__x
); }
664 cosh(double __x
) { return _C_legacy::_CPP_cosh_capture(__x
); }
667 exp(double __x
) { return _C_legacy::_CPP_exp_capture(__x
); }
670 fabs(double __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
673 floor(double __x
) { return _C_legacy::_CPP_floor_capture(__x
); }
676 fmod(double __x
, double __y
)
677 { return _C_legacy::_CPP_fmod_capture(__x
, __y
); }
680 frexp(double __x
, int* __exp
)
681 { return _C_legacy::_CPP_frexp_capture(__x
, __exp
); }
684 ldexp(double __x
, int __exp
)
685 { return _C_legacy::_CPP_ldexp_capture(__x
, __exp
); }
688 log(double __x
) { return _C_legacy::_CPP_log_capture(__x
); }
691 log10(double __x
) { return _C_legacy::_CPP_log10_capture(__x
); }
694 modf(double __x
, double* __iptr
)
695 { return _C_legacy::_CPP_modf_capture(__x
, __iptr
); }
698 pow(double __x
, double __y
)
699 { return _C_legacy::_CPP_pow_capture(__x
, __y
); }
705 sin(double __x
) { return _C_legacy::_CPP_sin_capture(__x
); }
708 sinh(double __x
) { return _C_legacy::_CPP_sinh_capture(__x
); }
711 sqrt(double __x
) { return _C_legacy::_CPP_sqrt_capture(__x
); }
714 tan(double __x
) { return _C_legacy::_CPP_tan_capture(__x
); }
717 tanh(double __x
) { return _C_legacy::_CPP_tanh_capture(__x
); }
720 abs(long double __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
723 acos(long double __x
) { return _C_legacy::_CPP_acos_capture(__x
); }
726 asin(long double __x
) { return _C_legacy::_CPP_asin_capture(__x
); }
729 atan(long double __x
) { return _C_legacy::_CPP_atan_capture(__x
); }
732 atan2(long double __y
, long double __x
)
733 { return _C_legacy::_CPP_atan2_capture(__y
, __x
); }
736 ceil(long double __x
) { return _C_legacy::_CPP_ceil_capture(__x
); }
739 cos(long double __x
) { return _C_legacy::_CPP_cos_capture(__x
); }
742 cosh(long double __x
) { return _C_legacy::_CPP_cosh_capture(__x
); }
745 exp(long double __x
) { return _C_legacy::_CPP_exp_capture(__x
); }
748 fabs(long double __x
) { return _C_legacy::_CPP_fabs_capture(__x
); }
751 floor(long double __x
) { return _C_legacy::_CPP_floor_capture(__x
); }
754 fmod(long double __x
, long double __y
)
755 { return _C_legacy::_CPP_fmod_capture(__x
, __y
); }
758 frexp(long double __x
, int* __exp
)
759 { return _C_legacy::_CPP_frexp_capture(__x
, __exp
); }
762 ldexp(long double __x
, int __exp
)
763 { return _C_legacy::_CPP_ldexp_capture(__x
, __exp
); }
766 log(long double __x
) { return _C_legacy::_CPP_log_capture(__x
); }
769 log10(long double __x
) { return _C_legacy::_CPP_log10_capture(__x
); }
772 modf(long double __x
, long double* __iptr
)
773 { return _C_legacy::_CPP_modf_capture(__x
, __iptr
); }
776 pow(long double __x
, long double __y
)
777 { return _C_legacy::_CPP_pow_capture(__x
, __y
); }
780 pow(long double, int);
783 sin(long double __x
) { return _C_legacy::_CPP_sin_capture(__x
); }
786 sinh(long double __x
) { return _C_legacy::_CPP_sinh_capture(__x
); }
789 sqrt(long double __x
) { return _C_legacy::_CPP_sqrt_capture(__x
); }
792 tan(long double __x
) { return _C_legacy::_CPP_tan_capture(__x
); }
795 tanh(long double __x
) { return _C_legacy::_CPP_tanh_capture(__x
); }
799 # undef _IN_C_LEGACY_