1 // -*- C++ -*- C forwarding header.
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010, 2011
5 // Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // Under Section 7 of GPL version 3, you are granted additional
19 // permissions described in the GCC Runtime Library Exception, version
20 // 3.1, as published by the Free Software Foundation.
22 // You should have received a copy of the GNU General Public License and
23 // a copy of the GCC Runtime Library Exception along with this program;
24 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 // <http://www.gnu.org/licenses/>.
27 /** @file include/cmath
28 * This is a Standard C++ Library file. You should @c \#include this file
29 * in your programs, rather than any of the @a *.h implementation files.
31 * This is the C++ version of the Standard C Library header @c math.h,
32 * and its contents are (mostly) the same as that header, but are all
33 * contained in the namespace @c std (except for names which are defined
38 // ISO C++ 14882: 26.5 C library
41 #pragma GCC system_header
43 #include <bits/c++config.h>
44 #include <bits/cpp_type_traits.h>
45 #include <ext/type_traits.h>
48 #ifndef _GLIBCXX_CMATH
49 #define _GLIBCXX_CMATH 1
51 // Get rid of those macros defined in <math.h> in lieu of real functions.
77 namespace std _GLIBCXX_VISIBILITY(default)
79 _GLIBCXX_BEGIN_NAMESPACE_VERSION
83 { return __builtin_fabs(__x); }
87 { return __builtin_fabsf(__x); }
91 { return __builtin_fabsl(__x); }
93 template<typename _Tp>
94 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
97 { return __builtin_fabs(__x); }
103 { return __builtin_acosf(__x); }
106 acos(long double __x)
107 { return __builtin_acosl(__x); }
109 template<typename _Tp>
110 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
113 { return __builtin_acos(__x); }
119 { return __builtin_asinf(__x); }
122 asin(long double __x)
123 { return __builtin_asinl(__x); }
125 template<typename _Tp>
126 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
129 { return __builtin_asin(__x); }
135 { return __builtin_atanf(__x); }
138 atan(long double __x)
139 { return __builtin_atanl(__x); }
141 template<typename _Tp>
142 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
145 { return __builtin_atan(__x); }
150 atan2(float __y, float __x)
151 { return __builtin_atan2f(__y, __x); }
154 atan2(long double __y, long double __x)
155 { return __builtin_atan2l(__y, __x); }
157 template<typename _Tp, typename _Up>
159 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
160 atan2(_Tp __y, _Up __x)
162 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
163 return atan2(__type(__y), __type(__x));
170 { return __builtin_ceilf(__x); }
173 ceil(long double __x)
174 { return __builtin_ceill(__x); }
176 template<typename _Tp>
177 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
180 { return __builtin_ceil(__x); }
186 { return __builtin_cosf(__x); }
190 { return __builtin_cosl(__x); }
192 template<typename _Tp>
193 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
196 { return __builtin_cos(__x); }
202 { return __builtin_coshf(__x); }
205 cosh(long double __x)
206 { return __builtin_coshl(__x); }
208 template<typename _Tp>
209 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
212 { return __builtin_cosh(__x); }
218 { return __builtin_expf(__x); }
222 { return __builtin_expl(__x); }
224 template<typename _Tp>
225 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
228 { return __builtin_exp(__x); }
234 { return __builtin_fabsf(__x); }
237 fabs(long double __x)
238 { return __builtin_fabsl(__x); }
240 template<typename _Tp>
241 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
244 { return __builtin_fabs(__x); }
250 { return __builtin_floorf(__x); }
253 floor(long double __x)
254 { return __builtin_floorl(__x); }
256 template<typename _Tp>
257 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
260 { return __builtin_floor(__x); }
265 fmod(float __x, float __y)
266 { return __builtin_fmodf(__x, __y); }
269 fmod(long double __x, long double __y)
270 { return __builtin_fmodl(__x, __y); }
275 frexp(float __x, int* __exp)
276 { return __builtin_frexpf(__x, __exp); }
279 frexp(long double __x, int* __exp)
280 { return __builtin_frexpl(__x, __exp); }
282 template<typename _Tp>
283 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
285 frexp(_Tp __x, int* __exp)
286 { return __builtin_frexp(__x, __exp); }
291 ldexp(float __x, int __exp)
292 { return __builtin_ldexpf(__x, __exp); }
295 ldexp(long double __x, int __exp)
296 { return __builtin_ldexpl(__x, __exp); }
298 template<typename _Tp>
299 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
301 ldexp(_Tp __x, int __exp)
302 { return __builtin_ldexp(__x, __exp); }
308 { return __builtin_logf(__x); }
312 { return __builtin_logl(__x); }
314 template<typename _Tp>
315 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
318 { return __builtin_log(__x); }
324 { return __builtin_log10f(__x); }
327 log10(long double __x)
328 { return __builtin_log10l(__x); }
330 template<typename _Tp>
331 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
334 { return __builtin_log10(__x); }
339 modf(float __x, float* __iptr)
340 { return __builtin_modff(__x, __iptr); }
343 modf(long double __x, long double* __iptr)
344 { return __builtin_modfl(__x, __iptr); }
349 pow(float __x, float __y)
350 { return __builtin_powf(__x, __y); }
353 pow(long double __x, long double __y)
354 { return __builtin_powl(__x, __y); }
356 #ifndef __GXX_EXPERIMENTAL_CXX0X__
357 // _GLIBCXX_RESOLVE_LIB_DEFECTS
358 // DR 550. What should the return type of pow(float,int) be?
360 pow(double __x, int __i)
361 { return __builtin_powi(__x, __i); }
364 pow(float __x, int __n)
365 { return __builtin_powif(__x, __n); }
368 pow(long double __x, int __n)
369 { return __builtin_powil(__x, __n); }
372 template<typename _Tp, typename _Up>
374 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
375 pow(_Tp __x, _Up __y)
377 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
378 return pow(__type(__x), __type(__y));
385 { return __builtin_sinf(__x); }
389 { return __builtin_sinl(__x); }
391 template<typename _Tp>
392 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
395 { return __builtin_sin(__x); }
401 { return __builtin_sinhf(__x); }
404 sinh(long double __x)
405 { return __builtin_sinhl(__x); }
407 template<typename _Tp>
408 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
411 { return __builtin_sinh(__x); }
417 { return __builtin_sqrtf(__x); }
420 sqrt(long double __x)
421 { return __builtin_sqrtl(__x); }
423 template<typename _Tp>
424 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
427 { return __builtin_sqrt(__x); }
433 { return __builtin_tanf(__x); }
437 { return __builtin_tanl(__x); }
439 template<typename _Tp>
440 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
443 { return __builtin_tan(__x); }
449 { return __builtin_tanhf(__x); }
452 tanh(long double __x)
453 { return __builtin_tanhl(__x); }
455 template<typename _Tp>
456 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
459 { return __builtin_tanh(__x); }
461 _GLIBCXX_END_NAMESPACE_VERSION
464 #if _GLIBCXX_USE_C99_MATH
465 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
467 // These are possible macros imported from C99-land.
475 #undef isgreaterequal
481 namespace std _GLIBCXX_VISIBILITY(default)
483 _GLIBCXX_BEGIN_NAMESPACE_VERSION
485 #ifdef __GXX_EXPERIMENTAL_CXX0X__
487 fpclassify(float __x)
488 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
489 FP_SUBNORMAL, FP_ZERO, __x); }
492 fpclassify(double __x)
493 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
494 FP_SUBNORMAL, FP_ZERO, __x); }
497 fpclassify(long double __x)
498 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
499 FP_SUBNORMAL, FP_ZERO, __x); }
501 template<typename _Tp>
502 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
505 { return __x != 0 ? FP_NORMAL : FP_ZERO; }
509 { return __builtin_isfinite(__x); }
513 { return __builtin_isfinite(__x); }
516 isfinite(long double __x)
517 { return __builtin_isfinite(__x); }
519 template<typename _Tp>
520 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
527 { return __builtin_isinf(__x); }
531 { return __builtin_isinf(__x); }
534 isinf(long double __x)
535 { return __builtin_isinf(__x); }
537 template<typename _Tp>
538 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
545 { return __builtin_isnan(__x); }
549 { return __builtin_isnan(__x); }
552 isnan(long double __x)
553 { return __builtin_isnan(__x); }
555 template<typename _Tp>
556 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
563 { return __builtin_isnormal(__x); }
567 { return __builtin_isnormal(__x); }
570 isnormal(long double __x)
571 { return __builtin_isnormal(__x); }
573 template<typename _Tp>
574 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
577 { return __x != 0 ? true : false; }
581 { return __builtin_signbit(__x); }
585 { return __builtin_signbit(__x); }
588 signbit(long double __x)
589 { return __builtin_signbit(__x); }
591 template<typename _Tp>
592 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
595 { return __x < 0 ? true : false; }
598 isgreater(float __x, float __y)
599 { return __builtin_isgreater(__x, __y); }
602 isgreater(double __x, double __y)
603 { return __builtin_isgreater(__x, __y); }
606 isgreater(long double __x, long double __y)
607 { return __builtin_isgreater(__x, __y); }
609 template<typename _Tp, typename _Up>
611 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
612 && __is_arithmetic<_Up>::__value), bool>::__type
613 isgreater(_Tp __x, _Up __y)
615 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
616 return __builtin_isgreater(__type(__x), __type(__y));
620 isgreaterequal(float __x, float __y)
621 { return __builtin_isgreaterequal(__x, __y); }
624 isgreaterequal(double __x, double __y)
625 { return __builtin_isgreaterequal(__x, __y); }
628 isgreaterequal(long double __x, long double __y)
629 { return __builtin_isgreaterequal(__x, __y); }
631 template<typename _Tp, typename _Up>
633 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
634 && __is_arithmetic<_Up>::__value), bool>::__type
635 isgreaterequal(_Tp __x, _Up __y)
637 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
638 return __builtin_isgreaterequal(__type(__x), __type(__y));
642 isless(float __x, float __y)
643 { return __builtin_isless(__x, __y); }
646 isless(double __x, double __y)
647 { return __builtin_isless(__x, __y); }
650 isless(long double __x, long double __y)
651 { return __builtin_isless(__x, __y); }
653 template<typename _Tp, typename _Up>
655 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
656 && __is_arithmetic<_Up>::__value), bool>::__type
657 isless(_Tp __x, _Up __y)
659 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
660 return __builtin_isless(__type(__x), __type(__y));
664 islessequal(float __x, float __y)
665 { return __builtin_islessequal(__x, __y); }
668 islessequal(double __x, double __y)
669 { return __builtin_islessequal(__x, __y); }
672 islessequal(long double __x, long double __y)
673 { return __builtin_islessequal(__x, __y); }
675 template<typename _Tp, typename _Up>
677 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
678 && __is_arithmetic<_Up>::__value), bool>::__type
679 islessequal(_Tp __x, _Up __y)
681 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
682 return __builtin_islessequal(__type(__x), __type(__y));
686 islessgreater(float __x, float __y)
687 { return __builtin_islessgreater(__x, __y); }
690 islessgreater(double __x, double __y)
691 { return __builtin_islessgreater(__x, __y); }
694 islessgreater(long double __x, long double __y)
695 { return __builtin_islessgreater(__x, __y); }
697 template<typename _Tp, typename _Up>
699 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
700 && __is_arithmetic<_Up>::__value), bool>::__type
701 islessgreater(_Tp __x, _Up __y)
703 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
704 return __builtin_islessgreater(__type(__x), __type(__y));
708 isunordered(float __x, float __y)
709 { return __builtin_isunordered(__x, __y); }
712 isunordered(double __x, double __y)
713 { return __builtin_isunordered(__x, __y); }
716 isunordered(long double __x, long double __y)
717 { return __builtin_isunordered(__x, __y); }
719 template<typename _Tp, typename _Up>
721 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
722 && __is_arithmetic<_Up>::__value), bool>::__type
723 isunordered(_Tp __x, _Up __y)
725 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
726 return __builtin_isunordered(__type(__x), __type(__y));
731 template<typename _Tp>
732 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
736 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
737 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
738 FP_SUBNORMAL, FP_ZERO, __type(__f));
741 template<typename _Tp>
742 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
746 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
747 return __builtin_isfinite(__type(__f));
750 template<typename _Tp>
751 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
755 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
756 return __builtin_isinf(__type(__f));
759 template<typename _Tp>
760 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
764 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
765 return __builtin_isnan(__type(__f));
768 template<typename _Tp>
769 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
773 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
774 return __builtin_isnormal(__type(__f));
777 template<typename _Tp>
778 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
782 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
783 return __builtin_signbit(__type(__f));
786 template<typename _Tp>
787 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
789 isgreater(_Tp __f1, _Tp __f2)
791 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
792 return __builtin_isgreater(__type(__f1), __type(__f2));
795 template<typename _Tp>
796 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
798 isgreaterequal(_Tp __f1, _Tp __f2)
800 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
801 return __builtin_isgreaterequal(__type(__f1), __type(__f2));
804 template<typename _Tp>
805 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
807 isless(_Tp __f1, _Tp __f2)
809 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
810 return __builtin_isless(__type(__f1), __type(__f2));
813 template<typename _Tp>
814 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
816 islessequal(_Tp __f1, _Tp __f2)
818 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
819 return __builtin_islessequal(__type(__f1), __type(__f2));
822 template<typename _Tp>
823 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
825 islessgreater(_Tp __f1, _Tp __f2)
827 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
828 return __builtin_islessgreater(__type(__f1), __type(__f2));
831 template<typename _Tp>
832 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
834 isunordered(_Tp __f1, _Tp __f2)
836 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
837 return __builtin_isunordered(__type(__f1), __type(__f2));
842 _GLIBCXX_END_NAMESPACE_VERSION
845 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
848 #ifdef __GXX_EXPERIMENTAL_CXX0X__
850 #ifdef _GLIBCXX_USE_C99_MATH_TR1
958 namespace std _GLIBCXX_VISIBILITY(default)
960 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1072 using ::nexttowardf;
1073 using ::nexttowardl;
1107 /// Additional overloads.
1110 { return __builtin_acoshf(__x); }
1113 acosh(long double __x)
1114 { return __builtin_acoshl(__x); }
1116 template<typename _Tp>
1117 inline typename __gnu_cxx::__promote<_Tp>::__type
1120 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1121 return acosh(__type(__x));
1126 { return __builtin_asinhf(__x); }
1129 asinh(long double __x)
1130 { return __builtin_asinhl(__x); }
1132 template<typename _Tp>
1133 inline typename __gnu_cxx::__promote<_Tp>::__type
1136 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1137 return asinh(__type(__x));
1142 { return __builtin_atanhf(__x); }
1145 atanh(long double __x)
1146 { return __builtin_atanhl(__x); }
1148 template<typename _Tp>
1149 inline typename __gnu_cxx::__promote<_Tp>::__type
1152 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1153 return atanh(__type(__x));
1158 { return __builtin_cbrtf(__x); }
1161 cbrt(long double __x)
1162 { return __builtin_cbrtl(__x); }
1164 template<typename _Tp>
1165 inline typename __gnu_cxx::__promote<_Tp>::__type
1168 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1169 return cbrt(__type(__x));
1173 copysign(float __x, float __y)
1174 { return __builtin_copysignf(__x, __y); }
1177 copysign(long double __x, long double __y)
1178 { return __builtin_copysignl(__x, __y); }
1180 template<typename _Tp, typename _Up>
1181 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1182 copysign(_Tp __x, _Up __y)
1184 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1185 return copysign(__type(__x), __type(__y));
1190 { return __builtin_erff(__x); }
1193 erf(long double __x)
1194 { return __builtin_erfl(__x); }
1196 template<typename _Tp>
1197 inline typename __gnu_cxx::__promote<_Tp>::__type
1200 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1201 return erf(__type(__x));
1206 { return __builtin_erfcf(__x); }
1209 erfc(long double __x)
1210 { return __builtin_erfcl(__x); }
1212 template<typename _Tp>
1213 inline typename __gnu_cxx::__promote<_Tp>::__type
1216 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1217 return erfc(__type(__x));
1222 { return __builtin_exp2f(__x); }
1225 exp2(long double __x)
1226 { return __builtin_exp2l(__x); }
1228 template<typename _Tp>
1229 inline typename __gnu_cxx::__promote<_Tp>::__type
1232 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1233 return exp2(__type(__x));
1238 { return __builtin_expm1f(__x); }
1241 expm1(long double __x)
1242 { return __builtin_expm1l(__x); }
1244 template<typename _Tp>
1245 inline typename __gnu_cxx::__promote<_Tp>::__type
1248 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1249 return expm1(__type(__x));
1253 fdim(float __x, float __y)
1254 { return __builtin_fdimf(__x, __y); }
1257 fdim(long double __x, long double __y)
1258 { return __builtin_fdiml(__x, __y); }
1260 template<typename _Tp, typename _Up>
1261 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1262 fdim(_Tp __x, _Up __y)
1264 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1265 return fdim(__type(__x), __type(__y));
1269 fma(float __x, float __y, float __z)
1270 { return __builtin_fmaf(__x, __y, __z); }
1273 fma(long double __x, long double __y, long double __z)
1274 { return __builtin_fmal(__x, __y, __z); }
1276 template<typename _Tp, typename _Up, typename _Vp>
1277 inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
1278 fma(_Tp __x, _Up __y, _Vp __z)
1280 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1281 return fma(__type(__x), __type(__y), __type(__z));
1285 fmax(float __x, float __y)
1286 { return __builtin_fmaxf(__x, __y); }
1289 fmax(long double __x, long double __y)
1290 { return __builtin_fmaxl(__x, __y); }
1292 template<typename _Tp, typename _Up>
1293 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1294 fmax(_Tp __x, _Up __y)
1296 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1297 return fmax(__type(__x), __type(__y));
1301 fmin(float __x, float __y)
1302 { return __builtin_fminf(__x, __y); }
1305 fmin(long double __x, long double __y)
1306 { return __builtin_fminl(__x, __y); }
1308 template<typename _Tp, typename _Up>
1309 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1310 fmin(_Tp __x, _Up __y)
1312 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1313 return fmin(__type(__x), __type(__y));
1317 hypot(float __x, float __y)
1318 { return __builtin_hypotf(__x, __y); }
1321 hypot(long double __x, long double __y)
1322 { return __builtin_hypotl(__x, __y); }
1324 template<typename _Tp, typename _Up>
1325 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1326 hypot(_Tp __x, _Up __y)
1328 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1329 return hypot(__type(__x), __type(__y));
1334 { return __builtin_ilogbf(__x); }
1337 ilogb(long double __x)
1338 { return __builtin_ilogbl(__x); }
1340 template<typename _Tp>
1344 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1345 return ilogb(__type(__x));
1350 { return __builtin_lgammaf(__x); }
1353 lgamma(long double __x)
1354 { return __builtin_lgammal(__x); }
1356 template<typename _Tp>
1357 inline typename __gnu_cxx::__promote<_Tp>::__type
1360 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1361 return lgamma(__type(__x));
1366 { return __builtin_llrintf(__x); }
1369 llrint(long double __x)
1370 { return __builtin_llrintl(__x); }
1372 template<typename _Tp>
1376 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1377 return llrint(__type(__x));
1382 { return __builtin_llroundf(__x); }
1385 llround(long double __x)
1386 { return __builtin_llroundl(__x); }
1388 template<typename _Tp>
1392 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1393 return llround(__type(__x));
1398 { return __builtin_log1pf(__x); }
1401 log1p(long double __x)
1402 { return __builtin_log1pl(__x); }
1404 template<typename _Tp>
1405 inline typename __gnu_cxx::__promote<_Tp>::__type
1408 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1409 return log1p(__type(__x));
1415 { return __builtin_log2f(__x); }
1418 log2(long double __x)
1419 { return __builtin_log2l(__x); }
1421 template<typename _Tp>
1422 inline typename __gnu_cxx::__promote<_Tp>::__type
1425 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1426 return log2(__type(__x));
1431 { return __builtin_logbf(__x); }
1434 logb(long double __x)
1435 { return __builtin_logbl(__x); }
1437 template<typename _Tp>
1438 inline typename __gnu_cxx::__promote<_Tp>::__type
1441 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1442 return logb(__type(__x));
1447 { return __builtin_lrintf(__x); }
1450 lrint(long double __x)
1451 { return __builtin_lrintl(__x); }
1453 template<typename _Tp>
1457 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1458 return lrint(__type(__x));
1463 { return __builtin_lroundf(__x); }
1466 lround(long double __x)
1467 { return __builtin_lroundl(__x); }
1469 template<typename _Tp>
1473 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1474 return lround(__type(__x));
1478 nearbyint(float __x)
1479 { return __builtin_nearbyintf(__x); }
1482 nearbyint(long double __x)
1483 { return __builtin_nearbyintl(__x); }
1485 template<typename _Tp>
1486 inline typename __gnu_cxx::__promote<_Tp>::__type
1489 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1490 return nearbyint(__type(__x));
1494 nextafter(float __x, float __y)
1495 { return __builtin_nextafterf(__x, __y); }
1498 nextafter(long double __x, long double __y)
1499 { return __builtin_nextafterl(__x, __y); }
1501 template<typename _Tp, typename _Up>
1502 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1503 nextafter(_Tp __x, _Up __y)
1505 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1506 return nextafter(__type(__x), __type(__y));
1510 nexttoward(float __x, long double __y)
1511 { return __builtin_nexttowardf(__x, __y); }
1514 nexttoward(long double __x, long double __y)
1515 { return __builtin_nexttowardl(__x, __y); }
1517 template<typename _Tp>
1518 inline typename __gnu_cxx::__promote<_Tp>::__type
1519 nexttoward(_Tp __x, long double __y)
1521 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1522 return nexttoward(__type(__x), __y);
1526 remainder(float __x, float __y)
1527 { return __builtin_remainderf(__x, __y); }
1530 remainder(long double __x, long double __y)
1531 { return __builtin_remainderl(__x, __y); }
1533 template<typename _Tp, typename _Up>
1534 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1535 remainder(_Tp __x, _Up __y)
1537 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1538 return remainder(__type(__x), __type(__y));
1542 remquo(float __x, float __y, int* __pquo)
1543 { return __builtin_remquof(__x, __y, __pquo); }
1546 remquo(long double __x, long double __y, int* __pquo)
1547 { return __builtin_remquol(__x, __y, __pquo); }
1549 template<typename _Tp, typename _Up>
1550 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1551 remquo(_Tp __x, _Up __y, int* __pquo)
1553 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1554 return remquo(__type(__x), __type(__y), __pquo);
1559 { return __builtin_rintf(__x); }
1562 rint(long double __x)
1563 { return __builtin_rintl(__x); }
1565 template<typename _Tp>
1566 inline typename __gnu_cxx::__promote<_Tp>::__type
1569 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1570 return rint(__type(__x));
1575 { return __builtin_roundf(__x); }
1578 round(long double __x)
1579 { return __builtin_roundl(__x); }
1581 template<typename _Tp>
1582 inline typename __gnu_cxx::__promote<_Tp>::__type
1585 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1586 return round(__type(__x));
1590 scalbln(float __x, long __ex)
1591 { return __builtin_scalblnf(__x, __ex); }
1594 scalbln(long double __x, long __ex)
1595 { return __builtin_scalblnl(__x, __ex); }
1597 template<typename _Tp>
1598 inline typename __gnu_cxx::__promote<_Tp>::__type
1599 scalbln(_Tp __x, long __ex)
1601 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1602 return scalbln(__type(__x), __ex);
1606 scalbn(float __x, int __ex)
1607 { return __builtin_scalbnf(__x, __ex); }
1610 scalbn(long double __x, int __ex)
1611 { return __builtin_scalbnl(__x, __ex); }
1613 template<typename _Tp>
1614 inline typename __gnu_cxx::__promote<_Tp>::__type
1615 scalbn(_Tp __x, int __ex)
1617 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1618 return scalbn(__type(__x), __ex);
1623 { return __builtin_tgammaf(__x); }
1626 tgamma(long double __x)
1627 { return __builtin_tgammal(__x); }
1629 template<typename _Tp>
1630 inline typename __gnu_cxx::__promote<_Tp>::__type
1633 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1634 return tgamma(__type(__x));
1639 { return __builtin_truncf(__x); }
1642 trunc(long double __x)
1643 { return __builtin_truncl(__x); }
1645 template<typename _Tp>
1646 inline typename __gnu_cxx::__promote<_Tp>::__type
1649 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1650 return trunc(__type(__x));
1653 _GLIBCXX_END_NAMESPACE_VERSION
1656 #endif // _GLIBCXX_USE_C99_MATH_TR1
1658 #endif // __GXX_EXPERIMENTAL_CXX0X__