1 // -*- C++ -*- C forwarding header.
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010
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<
160 typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
161 && __is_arithmetic<_Up>::__value,
162 _Tp>::__type, _Up>::__type
163 atan2(_Tp __y, _Up __x)
165 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
166 return atan2(__type(__y), __type(__x));
173 { return __builtin_ceilf(__x); }
176 ceil(long double __x)
177 { return __builtin_ceill(__x); }
179 template<typename _Tp>
180 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
183 { return __builtin_ceil(__x); }
189 { return __builtin_cosf(__x); }
193 { return __builtin_cosl(__x); }
195 template<typename _Tp>
196 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
199 { return __builtin_cos(__x); }
205 { return __builtin_coshf(__x); }
208 cosh(long double __x)
209 { return __builtin_coshl(__x); }
211 template<typename _Tp>
212 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
215 { return __builtin_cosh(__x); }
221 { return __builtin_expf(__x); }
225 { return __builtin_expl(__x); }
227 template<typename _Tp>
228 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
231 { return __builtin_exp(__x); }
237 { return __builtin_fabsf(__x); }
240 fabs(long double __x)
241 { return __builtin_fabsl(__x); }
243 template<typename _Tp>
244 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
247 { return __builtin_fabs(__x); }
253 { return __builtin_floorf(__x); }
256 floor(long double __x)
257 { return __builtin_floorl(__x); }
259 template<typename _Tp>
260 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
263 { return __builtin_floor(__x); }
268 fmod(float __x, float __y)
269 { return __builtin_fmodf(__x, __y); }
272 fmod(long double __x, long double __y)
273 { return __builtin_fmodl(__x, __y); }
278 frexp(float __x, int* __exp)
279 { return __builtin_frexpf(__x, __exp); }
282 frexp(long double __x, int* __exp)
283 { return __builtin_frexpl(__x, __exp); }
285 template<typename _Tp>
286 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
288 frexp(_Tp __x, int* __exp)
289 { return __builtin_frexp(__x, __exp); }
294 ldexp(float __x, int __exp)
295 { return __builtin_ldexpf(__x, __exp); }
298 ldexp(long double __x, int __exp)
299 { return __builtin_ldexpl(__x, __exp); }
301 template<typename _Tp>
302 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
304 ldexp(_Tp __x, int __exp)
305 { return __builtin_ldexp(__x, __exp); }
311 { return __builtin_logf(__x); }
315 { return __builtin_logl(__x); }
317 template<typename _Tp>
318 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
321 { return __builtin_log(__x); }
327 { return __builtin_log10f(__x); }
330 log10(long double __x)
331 { return __builtin_log10l(__x); }
333 template<typename _Tp>
334 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
337 { return __builtin_log10(__x); }
342 modf(float __x, float* __iptr)
343 { return __builtin_modff(__x, __iptr); }
346 modf(long double __x, long double* __iptr)
347 { return __builtin_modfl(__x, __iptr); }
352 pow(float __x, float __y)
353 { return __builtin_powf(__x, __y); }
356 pow(long double __x, long double __y)
357 { return __builtin_powl(__x, __y); }
359 #ifndef __GXX_EXPERIMENTAL_CXX0X__
360 // _GLIBCXX_RESOLVE_LIB_DEFECTS
361 // DR 550. What should the return type of pow(float,int) be?
363 pow(double __x, int __i)
364 { return __builtin_powi(__x, __i); }
367 pow(float __x, int __n)
368 { return __builtin_powif(__x, __n); }
371 pow(long double __x, int __n)
372 { return __builtin_powil(__x, __n); }
375 template<typename _Tp, typename _Up>
377 typename __gnu_cxx::__promote_2<
378 typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
379 && __is_arithmetic<_Up>::__value,
380 _Tp>::__type, _Up>::__type
381 pow(_Tp __x, _Up __y)
383 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
384 return pow(__type(__x), __type(__y));
391 { return __builtin_sinf(__x); }
395 { return __builtin_sinl(__x); }
397 template<typename _Tp>
398 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
401 { return __builtin_sin(__x); }
407 { return __builtin_sinhf(__x); }
410 sinh(long double __x)
411 { return __builtin_sinhl(__x); }
413 template<typename _Tp>
414 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
417 { return __builtin_sinh(__x); }
423 { return __builtin_sqrtf(__x); }
426 sqrt(long double __x)
427 { return __builtin_sqrtl(__x); }
429 template<typename _Tp>
430 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
433 { return __builtin_sqrt(__x); }
439 { return __builtin_tanf(__x); }
443 { return __builtin_tanl(__x); }
445 template<typename _Tp>
446 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
449 { return __builtin_tan(__x); }
455 { return __builtin_tanhf(__x); }
458 tanh(long double __x)
459 { return __builtin_tanhl(__x); }
461 template<typename _Tp>
462 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
465 { return __builtin_tanh(__x); }
467 _GLIBCXX_END_NAMESPACE_VERSION
470 #if _GLIBCXX_USE_C99_MATH
471 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
473 // These are possible macros imported from C99-land.
481 #undef isgreaterequal
487 namespace std _GLIBCXX_VISIBILITY(default)
489 _GLIBCXX_BEGIN_NAMESPACE_VERSION
491 #ifdef __GXX_EXPERIMENTAL_CXX0X__
493 fpclassify(float __x)
494 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
495 FP_SUBNORMAL, FP_ZERO, __x); }
498 fpclassify(double __x)
499 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
500 FP_SUBNORMAL, FP_ZERO, __x); }
503 fpclassify(long double __x)
504 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
505 FP_SUBNORMAL, FP_ZERO, __x); }
507 template<typename _Tp>
508 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
511 { return __x != 0 ? FP_NORMAL : FP_ZERO; }
515 { return __builtin_isfinite(__x); }
519 { return __builtin_isfinite(__x); }
522 isfinite(long double __x)
523 { return __builtin_isfinite(__x); }
525 template<typename _Tp>
526 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
533 { return __builtin_isinf(__x); }
537 { return __builtin_isinf(__x); }
540 isinf(long double __x)
541 { return __builtin_isinf(__x); }
543 template<typename _Tp>
544 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
551 { return __builtin_isnan(__x); }
555 { return __builtin_isnan(__x); }
558 isnan(long double __x)
559 { return __builtin_isnan(__x); }
561 template<typename _Tp>
562 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
569 { return __builtin_isnormal(__x); }
573 { return __builtin_isnormal(__x); }
576 isnormal(long double __x)
577 { return __builtin_isnormal(__x); }
579 template<typename _Tp>
580 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
583 { return __x != 0 ? true : false; }
587 { return __builtin_signbit(__x); }
591 { return __builtin_signbit(__x); }
594 signbit(long double __x)
595 { return __builtin_signbit(__x); }
597 template<typename _Tp>
598 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
601 { return __x < 0 ? true : false; }
604 isgreater(float __x, float __y)
605 { return __builtin_isgreater(__x, __y); }
608 isgreater(double __x, double __y)
609 { return __builtin_isgreater(__x, __y); }
612 isgreater(long double __x, long double __y)
613 { return __builtin_isgreater(__x, __y); }
615 template<typename _Tp, typename _Up>
617 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
618 && __is_arithmetic<_Up>::__value), bool>::__type
619 isgreater(_Tp __x, _Up __y)
621 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
622 return __builtin_isgreater(__type(__x), __type(__y));
626 isgreaterequal(float __x, float __y)
627 { return __builtin_isgreaterequal(__x, __y); }
630 isgreaterequal(double __x, double __y)
631 { return __builtin_isgreaterequal(__x, __y); }
634 isgreaterequal(long double __x, long double __y)
635 { return __builtin_isgreaterequal(__x, __y); }
637 template<typename _Tp, typename _Up>
639 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
640 && __is_arithmetic<_Up>::__value), bool>::__type
641 isgreaterequal(_Tp __x, _Up __y)
643 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
644 return __builtin_isgreaterequal(__type(__x), __type(__y));
648 isless(float __x, float __y)
649 { return __builtin_isless(__x, __y); }
652 isless(double __x, double __y)
653 { return __builtin_isless(__x, __y); }
656 isless(long double __x, long double __y)
657 { return __builtin_isless(__x, __y); }
659 template<typename _Tp, typename _Up>
661 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
662 && __is_arithmetic<_Up>::__value), bool>::__type
663 isless(_Tp __x, _Up __y)
665 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
666 return __builtin_isless(__type(__x), __type(__y));
670 islessequal(float __x, float __y)
671 { return __builtin_islessequal(__x, __y); }
674 islessequal(double __x, double __y)
675 { return __builtin_islessequal(__x, __y); }
678 islessequal(long double __x, long double __y)
679 { return __builtin_islessequal(__x, __y); }
681 template<typename _Tp, typename _Up>
683 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
684 && __is_arithmetic<_Up>::__value), bool>::__type
685 islessequal(_Tp __x, _Up __y)
687 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
688 return __builtin_islessequal(__type(__x), __type(__y));
692 islessgreater(float __x, float __y)
693 { return __builtin_islessgreater(__x, __y); }
696 islessgreater(double __x, double __y)
697 { return __builtin_islessgreater(__x, __y); }
700 islessgreater(long double __x, long double __y)
701 { return __builtin_islessgreater(__x, __y); }
703 template<typename _Tp, typename _Up>
705 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
706 && __is_arithmetic<_Up>::__value), bool>::__type
707 islessgreater(_Tp __x, _Up __y)
709 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
710 return __builtin_islessgreater(__type(__x), __type(__y));
714 isunordered(float __x, float __y)
715 { return __builtin_isunordered(__x, __y); }
718 isunordered(double __x, double __y)
719 { return __builtin_isunordered(__x, __y); }
722 isunordered(long double __x, long double __y)
723 { return __builtin_isunordered(__x, __y); }
725 template<typename _Tp, typename _Up>
727 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
728 && __is_arithmetic<_Up>::__value), bool>::__type
729 isunordered(_Tp __x, _Up __y)
731 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
732 return __builtin_isunordered(__type(__x), __type(__y));
737 template<typename _Tp>
738 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
742 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
743 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
744 FP_SUBNORMAL, FP_ZERO, __type(__f));
747 template<typename _Tp>
748 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
752 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
753 return __builtin_isfinite(__type(__f));
756 template<typename _Tp>
757 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
761 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
762 return __builtin_isinf(__type(__f));
765 template<typename _Tp>
766 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
770 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
771 return __builtin_isnan(__type(__f));
774 template<typename _Tp>
775 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
779 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
780 return __builtin_isnormal(__type(__f));
783 template<typename _Tp>
784 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
788 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
789 return __builtin_signbit(__type(__f));
792 template<typename _Tp>
793 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
795 isgreater(_Tp __f1, _Tp __f2)
797 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
798 return __builtin_isgreater(__type(__f1), __type(__f2));
801 template<typename _Tp>
802 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
804 isgreaterequal(_Tp __f1, _Tp __f2)
806 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
807 return __builtin_isgreaterequal(__type(__f1), __type(__f2));
810 template<typename _Tp>
811 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
813 isless(_Tp __f1, _Tp __f2)
815 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
816 return __builtin_isless(__type(__f1), __type(__f2));
819 template<typename _Tp>
820 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
822 islessequal(_Tp __f1, _Tp __f2)
824 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
825 return __builtin_islessequal(__type(__f1), __type(__f2));
828 template<typename _Tp>
829 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
831 islessgreater(_Tp __f1, _Tp __f2)
833 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
834 return __builtin_islessgreater(__type(__f1), __type(__f2));
837 template<typename _Tp>
838 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
840 isunordered(_Tp __f1, _Tp __f2)
842 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
843 return __builtin_isunordered(__type(__f1), __type(__f2));
848 _GLIBCXX_END_NAMESPACE_VERSION
851 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
854 #ifdef __GXX_EXPERIMENTAL_CXX0X__
856 #ifdef _GLIBCXX_USE_C99_MATH_TR1
964 namespace std _GLIBCXX_VISIBILITY(default)
966 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1078 using ::nexttowardf;
1079 using ::nexttowardl;
1113 /// Additional overloads.
1116 { return __builtin_acoshf(__x); }
1119 acosh(long double __x)
1120 { return __builtin_acoshl(__x); }
1122 template<typename _Tp>
1123 inline typename __gnu_cxx::__promote<_Tp>::__type
1126 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1127 return acosh(__type(__x));
1132 { return __builtin_asinhf(__x); }
1135 asinh(long double __x)
1136 { return __builtin_asinhl(__x); }
1138 template<typename _Tp>
1139 inline typename __gnu_cxx::__promote<_Tp>::__type
1142 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1143 return asinh(__type(__x));
1148 { return __builtin_atanhf(__x); }
1151 atanh(long double __x)
1152 { return __builtin_atanhl(__x); }
1154 template<typename _Tp>
1155 inline typename __gnu_cxx::__promote<_Tp>::__type
1158 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1159 return atanh(__type(__x));
1164 { return __builtin_cbrtf(__x); }
1167 cbrt(long double __x)
1168 { return __builtin_cbrtl(__x); }
1170 template<typename _Tp>
1171 inline typename __gnu_cxx::__promote<_Tp>::__type
1174 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1175 return cbrt(__type(__x));
1179 copysign(float __x, float __y)
1180 { return __builtin_copysignf(__x, __y); }
1183 copysign(long double __x, long double __y)
1184 { return __builtin_copysignl(__x, __y); }
1186 template<typename _Tp, typename _Up>
1187 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1188 copysign(_Tp __x, _Up __y)
1190 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1191 return copysign(__type(__x), __type(__y));
1196 { return __builtin_erff(__x); }
1199 erf(long double __x)
1200 { return __builtin_erfl(__x); }
1202 template<typename _Tp>
1203 inline typename __gnu_cxx::__promote<_Tp>::__type
1206 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1207 return erf(__type(__x));
1212 { return __builtin_erfcf(__x); }
1215 erfc(long double __x)
1216 { return __builtin_erfcl(__x); }
1218 template<typename _Tp>
1219 inline typename __gnu_cxx::__promote<_Tp>::__type
1222 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1223 return erfc(__type(__x));
1228 { return __builtin_exp2f(__x); }
1231 exp2(long double __x)
1232 { return __builtin_exp2l(__x); }
1234 template<typename _Tp>
1235 inline typename __gnu_cxx::__promote<_Tp>::__type
1238 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1239 return exp2(__type(__x));
1244 { return __builtin_expm1f(__x); }
1247 expm1(long double __x)
1248 { return __builtin_expm1l(__x); }
1250 template<typename _Tp>
1251 inline typename __gnu_cxx::__promote<_Tp>::__type
1254 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1255 return expm1(__type(__x));
1259 fdim(float __x, float __y)
1260 { return __builtin_fdimf(__x, __y); }
1263 fdim(long double __x, long double __y)
1264 { return __builtin_fdiml(__x, __y); }
1266 template<typename _Tp, typename _Up>
1267 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1268 fdim(_Tp __x, _Up __y)
1270 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1271 return fdim(__type(__x), __type(__y));
1275 fma(float __x, float __y, float __z)
1276 { return __builtin_fmaf(__x, __y, __z); }
1279 fma(long double __x, long double __y, long double __z)
1280 { return __builtin_fmal(__x, __y, __z); }
1282 template<typename _Tp, typename _Up, typename _Vp>
1283 inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
1284 fma(_Tp __x, _Up __y, _Vp __z)
1286 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1287 return fma(__type(__x), __type(__y), __type(__z));
1291 fmax(float __x, float __y)
1292 { return __builtin_fmaxf(__x, __y); }
1295 fmax(long double __x, long double __y)
1296 { return __builtin_fmaxl(__x, __y); }
1298 template<typename _Tp, typename _Up>
1299 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1300 fmax(_Tp __x, _Up __y)
1302 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1303 return fmax(__type(__x), __type(__y));
1307 fmin(float __x, float __y)
1308 { return __builtin_fminf(__x, __y); }
1311 fmin(long double __x, long double __y)
1312 { return __builtin_fminl(__x, __y); }
1314 template<typename _Tp, typename _Up>
1315 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1316 fmin(_Tp __x, _Up __y)
1318 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1319 return fmin(__type(__x), __type(__y));
1323 hypot(float __x, float __y)
1324 { return __builtin_hypotf(__x, __y); }
1327 hypot(long double __x, long double __y)
1328 { return __builtin_hypotl(__x, __y); }
1330 template<typename _Tp, typename _Up>
1331 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1332 hypot(_Tp __x, _Up __y)
1334 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1335 return hypot(__type(__x), __type(__y));
1340 { return __builtin_ilogbf(__x); }
1343 ilogb(long double __x)
1344 { return __builtin_ilogbl(__x); }
1346 template<typename _Tp>
1350 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1351 return ilogb(__type(__x));
1356 { return __builtin_lgammaf(__x); }
1359 lgamma(long double __x)
1360 { return __builtin_lgammal(__x); }
1362 template<typename _Tp>
1363 inline typename __gnu_cxx::__promote<_Tp>::__type
1366 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1367 return lgamma(__type(__x));
1372 { return __builtin_llrintf(__x); }
1375 llrint(long double __x)
1376 { return __builtin_llrintl(__x); }
1378 template<typename _Tp>
1382 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1383 return llrint(__type(__x));
1388 { return __builtin_llroundf(__x); }
1391 llround(long double __x)
1392 { return __builtin_llroundl(__x); }
1394 template<typename _Tp>
1398 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1399 return llround(__type(__x));
1404 { return __builtin_log1pf(__x); }
1407 log1p(long double __x)
1408 { return __builtin_log1pl(__x); }
1410 template<typename _Tp>
1411 inline typename __gnu_cxx::__promote<_Tp>::__type
1414 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1415 return log1p(__type(__x));
1421 { return __builtin_log2f(__x); }
1424 log2(long double __x)
1425 { return __builtin_log2l(__x); }
1427 template<typename _Tp>
1428 inline typename __gnu_cxx::__promote<_Tp>::__type
1431 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1432 return log2(__type(__x));
1437 { return __builtin_logbf(__x); }
1440 logb(long double __x)
1441 { return __builtin_logbl(__x); }
1443 template<typename _Tp>
1444 inline typename __gnu_cxx::__promote<_Tp>::__type
1447 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1448 return logb(__type(__x));
1453 { return __builtin_lrintf(__x); }
1456 lrint(long double __x)
1457 { return __builtin_lrintl(__x); }
1459 template<typename _Tp>
1463 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1464 return lrint(__type(__x));
1469 { return __builtin_lroundf(__x); }
1472 lround(long double __x)
1473 { return __builtin_lroundl(__x); }
1475 template<typename _Tp>
1479 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1480 return lround(__type(__x));
1484 nearbyint(float __x)
1485 { return __builtin_nearbyintf(__x); }
1488 nearbyint(long double __x)
1489 { return __builtin_nearbyintl(__x); }
1491 template<typename _Tp>
1492 inline typename __gnu_cxx::__promote<_Tp>::__type
1495 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1496 return nearbyint(__type(__x));
1500 nextafter(float __x, float __y)
1501 { return __builtin_nextafterf(__x, __y); }
1504 nextafter(long double __x, long double __y)
1505 { return __builtin_nextafterl(__x, __y); }
1507 template<typename _Tp, typename _Up>
1508 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1509 nextafter(_Tp __x, _Up __y)
1511 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1512 return nextafter(__type(__x), __type(__y));
1516 nexttoward(float __x, long double __y)
1517 { return __builtin_nexttowardf(__x, __y); }
1520 nexttoward(long double __x, long double __y)
1521 { return __builtin_nexttowardl(__x, __y); }
1523 template<typename _Tp>
1524 inline typename __gnu_cxx::__promote<_Tp>::__type
1525 nexttoward(_Tp __x, long double __y)
1527 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1528 return nexttoward(__type(__x), __y);
1532 remainder(float __x, float __y)
1533 { return __builtin_remainderf(__x, __y); }
1536 remainder(long double __x, long double __y)
1537 { return __builtin_remainderl(__x, __y); }
1539 template<typename _Tp, typename _Up>
1540 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1541 remainder(_Tp __x, _Up __y)
1543 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1544 return remainder(__type(__x), __type(__y));
1548 remquo(float __x, float __y, int* __pquo)
1549 { return __builtin_remquof(__x, __y, __pquo); }
1552 remquo(long double __x, long double __y, int* __pquo)
1553 { return __builtin_remquol(__x, __y, __pquo); }
1555 template<typename _Tp, typename _Up>
1556 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1557 remquo(_Tp __x, _Up __y, int* __pquo)
1559 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1560 return remquo(__type(__x), __type(__y), __pquo);
1565 { return __builtin_rintf(__x); }
1568 rint(long double __x)
1569 { return __builtin_rintl(__x); }
1571 template<typename _Tp>
1572 inline typename __gnu_cxx::__promote<_Tp>::__type
1575 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1576 return rint(__type(__x));
1581 { return __builtin_roundf(__x); }
1584 round(long double __x)
1585 { return __builtin_roundl(__x); }
1587 template<typename _Tp>
1588 inline typename __gnu_cxx::__promote<_Tp>::__type
1591 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1592 return round(__type(__x));
1596 scalbln(float __x, long __ex)
1597 { return __builtin_scalblnf(__x, __ex); }
1600 scalbln(long double __x, long __ex)
1601 { return __builtin_scalblnl(__x, __ex); }
1603 template<typename _Tp>
1604 inline typename __gnu_cxx::__promote<_Tp>::__type
1605 scalbln(_Tp __x, long __ex)
1607 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1608 return scalbln(__type(__x), __ex);
1612 scalbn(float __x, int __ex)
1613 { return __builtin_scalbnf(__x, __ex); }
1616 scalbn(long double __x, int __ex)
1617 { return __builtin_scalbnl(__x, __ex); }
1619 template<typename _Tp>
1620 inline typename __gnu_cxx::__promote<_Tp>::__type
1621 scalbn(_Tp __x, int __ex)
1623 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1624 return scalbn(__type(__x), __ex);
1629 { return __builtin_tgammaf(__x); }
1632 tgamma(long double __x)
1633 { return __builtin_tgammal(__x); }
1635 template<typename _Tp>
1636 inline typename __gnu_cxx::__promote<_Tp>::__type
1639 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1640 return tgamma(__type(__x));
1645 { return __builtin_truncf(__x); }
1648 trunc(long double __x)
1649 { return __builtin_truncl(__x); }
1651 template<typename _Tp>
1652 inline typename __gnu_cxx::__promote<_Tp>::__type
1655 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1656 return trunc(__type(__x));
1659 _GLIBCXX_END_NAMESPACE_VERSION
1662 #endif // _GLIBCXX_USE_C99_MATH_TR1
1664 #endif // __GXX_EXPERIMENTAL_CXX0X__