Ensure C++ language linkage in cmath and cstdlib
[official-gcc.git] / libstdc++-v3 / include / c_global / cmath
blobc4ee3f57fc373a065b96b20f08baf99b63f0c604
1 // -*- C++ -*- C forwarding header.
3 // Copyright (C) 1997-2016 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 3, or (at your option)
9 // any later version.
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 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23 // <http://www.gnu.org/licenses/>.
25 /** @file include/cmath
26  *  This is a Standard C++ Library file.  You should @c \#include this file
27  *  in your programs, rather than any of the @a *.h implementation files.
28  *
29  *  This is the C++ version of the Standard C Library header @c math.h,
30  *  and its contents are (mostly) the same as that header, but are all
31  *  contained in the namespace @c std (except for names which are defined
32  *  as macros in C).
33  */
36 // ISO C++ 14882: 26.5  C library
39 #pragma GCC system_header
41 #include <bits/c++config.h>
42 #include <bits/cpp_type_traits.h>
43 #include <ext/type_traits.h>
44 #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
45 #include_next <math.h>
46 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
48 #ifndef _GLIBCXX_CMATH
49 #define _GLIBCXX_CMATH 1
51 // Get rid of those macros defined in <math.h> in lieu of real functions.
52 #undef abs
53 #undef div
54 #undef acos
55 #undef asin
56 #undef atan
57 #undef atan2
58 #undef ceil
59 #undef cos
60 #undef cosh
61 #undef exp
62 #undef fabs
63 #undef floor
64 #undef fmod
65 #undef frexp
66 #undef ldexp
67 #undef log
68 #undef log10
69 #undef modf
70 #undef pow
71 #undef sin
72 #undef sinh
73 #undef sqrt
74 #undef tan
75 #undef tanh
77 extern "C++"
79 namespace std _GLIBCXX_VISIBILITY(default)
81 _GLIBCXX_BEGIN_NAMESPACE_VERSION
83 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
84   inline _GLIBCXX_CONSTEXPR double
85   abs(double __x)
86   { return __builtin_fabs(__x); }
87 #endif
89 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
90   inline _GLIBCXX_CONSTEXPR float
91   abs(float __x)
92   { return __builtin_fabsf(__x); }
94   inline _GLIBCXX_CONSTEXPR long double
95   abs(long double __x)
96   { return __builtin_fabsl(__x); }
97 #endif
99   template<typename _Tp>
100     inline _GLIBCXX_CONSTEXPR
101     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
102                                     double>::__type
103     abs(_Tp __x)
104     { return __builtin_fabs(__x); }
106   using ::acos;
108 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
109   inline _GLIBCXX_CONSTEXPR float
110   acos(float __x)
111   { return __builtin_acosf(__x); }
113   inline _GLIBCXX_CONSTEXPR long double
114   acos(long double __x)
115   { return __builtin_acosl(__x); }
116 #endif
118   template<typename _Tp>
119     inline _GLIBCXX_CONSTEXPR
120     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
121                                     double>::__type
122     acos(_Tp __x)
123     { return __builtin_acos(__x); }
125   using ::asin;
127 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
128   inline _GLIBCXX_CONSTEXPR float
129   asin(float __x)
130   { return __builtin_asinf(__x); }
132   inline _GLIBCXX_CONSTEXPR long double
133   asin(long double __x)
134   { return __builtin_asinl(__x); }
135 #endif
137   template<typename _Tp>
138     inline _GLIBCXX_CONSTEXPR
139     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
140                                     double>::__type
141     asin(_Tp __x)
142     { return __builtin_asin(__x); }
144   using ::atan;
146 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
147   inline _GLIBCXX_CONSTEXPR float
148   atan(float __x)
149   { return __builtin_atanf(__x); }
151   inline _GLIBCXX_CONSTEXPR long double
152   atan(long double __x)
153   { return __builtin_atanl(__x); }
154 #endif
156   template<typename _Tp>
157     inline _GLIBCXX_CONSTEXPR
158     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
159                                     double>::__type
160     atan(_Tp __x)
161     { return __builtin_atan(__x); }
163   using ::atan2;
165 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
166   inline _GLIBCXX_CONSTEXPR float
167   atan2(float __y, float __x)
168   { return __builtin_atan2f(__y, __x); }
170   inline _GLIBCXX_CONSTEXPR long double
171   atan2(long double __y, long double __x)
172   { return __builtin_atan2l(__y, __x); }
173 #endif
175   template<typename _Tp, typename _Up>
176     inline _GLIBCXX_CONSTEXPR
177     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
178     atan2(_Tp __y, _Up __x)
179     {
180       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
181       return atan2(__type(__y), __type(__x));
182     }
184   using ::ceil;
186 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
187   inline _GLIBCXX_CONSTEXPR float
188   ceil(float __x)
189   { return __builtin_ceilf(__x); }
191   inline _GLIBCXX_CONSTEXPR long double
192   ceil(long double __x)
193   { return __builtin_ceill(__x); }
194 #endif
196   template<typename _Tp>
197     inline _GLIBCXX_CONSTEXPR
198     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
199                                     double>::__type
200     ceil(_Tp __x)
201     { return __builtin_ceil(__x); }
203   using ::cos;
205 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
206   inline _GLIBCXX_CONSTEXPR float
207   cos(float __x)
208   { return __builtin_cosf(__x); }
210   inline _GLIBCXX_CONSTEXPR long double
211   cos(long double __x)
212   { return __builtin_cosl(__x); }
213 #endif
215   template<typename _Tp>
216     inline _GLIBCXX_CONSTEXPR
217     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
218                                     double>::__type
219     cos(_Tp __x)
220     { return __builtin_cos(__x); }
222   using ::cosh;
224 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
225   inline _GLIBCXX_CONSTEXPR float
226   cosh(float __x)
227   { return __builtin_coshf(__x); }
229   inline _GLIBCXX_CONSTEXPR long double
230   cosh(long double __x)
231   { return __builtin_coshl(__x); }
232 #endif
234   template<typename _Tp>
235     inline _GLIBCXX_CONSTEXPR
236     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
237                                     double>::__type
238     cosh(_Tp __x)
239     { return __builtin_cosh(__x); }
241   using ::exp;
243 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
244   inline _GLIBCXX_CONSTEXPR float
245   exp(float __x)
246   { return __builtin_expf(__x); }
248   inline _GLIBCXX_CONSTEXPR long double
249   exp(long double __x)
250   { return __builtin_expl(__x); }
251 #endif
253   template<typename _Tp>
254     inline _GLIBCXX_CONSTEXPR
255     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
256                                     double>::__type
257     exp(_Tp __x)
258     { return __builtin_exp(__x); }
260   using ::fabs;
262 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
263   inline _GLIBCXX_CONSTEXPR float
264   fabs(float __x)
265   { return __builtin_fabsf(__x); }
267   inline _GLIBCXX_CONSTEXPR long double
268   fabs(long double __x)
269   { return __builtin_fabsl(__x); }
270 #endif
272   template<typename _Tp>
273     inline _GLIBCXX_CONSTEXPR
274     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
275                                     double>::__type
276     fabs(_Tp __x)
277     { return __builtin_fabs(__x); }
279   using ::floor;
281 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
282   inline _GLIBCXX_CONSTEXPR float
283   floor(float __x)
284   { return __builtin_floorf(__x); }
286   inline _GLIBCXX_CONSTEXPR long double
287   floor(long double __x)
288   { return __builtin_floorl(__x); }
289 #endif
291   template<typename _Tp>
292     inline _GLIBCXX_CONSTEXPR
293     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
294                                     double>::__type
295     floor(_Tp __x)
296     { return __builtin_floor(__x); }
298   using ::fmod;
300 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
301   inline _GLIBCXX_CONSTEXPR float
302   fmod(float __x, float __y)
303   { return __builtin_fmodf(__x, __y); }
305   inline _GLIBCXX_CONSTEXPR long double
306   fmod(long double __x, long double __y)
307   { return __builtin_fmodl(__x, __y); }
308 #endif
310   template<typename _Tp, typename _Up>
311     inline _GLIBCXX_CONSTEXPR
312     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
313     fmod(_Tp __x, _Up __y)
314     {
315       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
316       return fmod(__type(__x), __type(__y));
317     }
319   using ::frexp;
321 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
322   inline float
323   frexp(float __x, int* __exp)
324   { return __builtin_frexpf(__x, __exp); }
326   inline long double
327   frexp(long double __x, int* __exp)
328   { return __builtin_frexpl(__x, __exp); }
329 #endif
331   template<typename _Tp>
332     inline _GLIBCXX_CONSTEXPR
333     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
334                                     double>::__type
335     frexp(_Tp __x, int* __exp)
336     { return __builtin_frexp(__x, __exp); }
338   using ::ldexp;
340 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
341   inline _GLIBCXX_CONSTEXPR float
342   ldexp(float __x, int __exp)
343   { return __builtin_ldexpf(__x, __exp); }
345   inline _GLIBCXX_CONSTEXPR long double
346   ldexp(long double __x, int __exp)
347   { return __builtin_ldexpl(__x, __exp); }
348 #endif
350   template<typename _Tp>
351     inline _GLIBCXX_CONSTEXPR
352     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
353                                     double>::__type
354     ldexp(_Tp __x, int __exp)
355     { return __builtin_ldexp(__x, __exp); }
357   using ::log;
359 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
360   inline _GLIBCXX_CONSTEXPR float
361   log(float __x)
362   { return __builtin_logf(__x); }
364   inline _GLIBCXX_CONSTEXPR long double
365   log(long double __x)
366   { return __builtin_logl(__x); }
367 #endif
369   template<typename _Tp>
370     inline _GLIBCXX_CONSTEXPR
371     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
372                                     double>::__type
373     log(_Tp __x)
374     { return __builtin_log(__x); }
376   using ::log10;
378 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
379   inline _GLIBCXX_CONSTEXPR float
380   log10(float __x)
381   { return __builtin_log10f(__x); }
383   inline _GLIBCXX_CONSTEXPR long double
384   log10(long double __x)
385   { return __builtin_log10l(__x); }
386 #endif
388   template<typename _Tp>
389     inline _GLIBCXX_CONSTEXPR
390     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
391                                     double>::__type
392     log10(_Tp __x)
393     { return __builtin_log10(__x); }
395   using ::modf;
397 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
398   inline float
399   modf(float __x, float* __iptr)
400   { return __builtin_modff(__x, __iptr); }
402   inline long double
403   modf(long double __x, long double* __iptr)
404   { return __builtin_modfl(__x, __iptr); }
405 #endif
407   using ::pow;
409 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
410   inline _GLIBCXX_CONSTEXPR float
411   pow(float __x, float __y)
412   { return __builtin_powf(__x, __y); }
414   inline _GLIBCXX_CONSTEXPR long double
415   pow(long double __x, long double __y)
416   { return __builtin_powl(__x, __y); }
418 #if __cplusplus < 201103L
419   // _GLIBCXX_RESOLVE_LIB_DEFECTS
420   // DR 550. What should the return type of pow(float,int) be?
421   inline double
422   pow(double __x, int __i)
423   { return __builtin_powi(__x, __i); }
425   inline float
426   pow(float __x, int __n)
427   { return __builtin_powif(__x, __n); }
429   inline long double
430   pow(long double __x, int __n)
431   { return __builtin_powil(__x, __n); }
432 #endif
433 #endif
435   template<typename _Tp, typename _Up>
436     inline _GLIBCXX_CONSTEXPR
437     typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
438     pow(_Tp __x, _Up __y)
439     {
440       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
441       return pow(__type(__x), __type(__y));
442     }
444   using ::sin;
446 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
447   inline _GLIBCXX_CONSTEXPR float
448   sin(float __x)
449   { return __builtin_sinf(__x); }
451   inline _GLIBCXX_CONSTEXPR long double
452   sin(long double __x)
453   { return __builtin_sinl(__x); }
454 #endif
456   template<typename _Tp>
457     inline _GLIBCXX_CONSTEXPR
458     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
459                                     double>::__type
460     sin(_Tp __x)
461     { return __builtin_sin(__x); }
463   using ::sinh;
465 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
466   inline _GLIBCXX_CONSTEXPR float
467   sinh(float __x)
468   { return __builtin_sinhf(__x); }
470   inline _GLIBCXX_CONSTEXPR long double
471   sinh(long double __x)
472   { return __builtin_sinhl(__x); }
473 #endif
475   template<typename _Tp>
476     inline _GLIBCXX_CONSTEXPR
477     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
478                                     double>::__type
479     sinh(_Tp __x)
480     { return __builtin_sinh(__x); }
482   using ::sqrt;
484 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
485   inline _GLIBCXX_CONSTEXPR float
486   sqrt(float __x)
487   { return __builtin_sqrtf(__x); }
489   inline _GLIBCXX_CONSTEXPR long double
490   sqrt(long double __x)
491   { return __builtin_sqrtl(__x); }
492 #endif
494   template<typename _Tp>
495     inline _GLIBCXX_CONSTEXPR
496     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
497                                     double>::__type
498     sqrt(_Tp __x)
499     { return __builtin_sqrt(__x); }
501   using ::tan;
503 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
504   inline _GLIBCXX_CONSTEXPR float
505   tan(float __x)
506   { return __builtin_tanf(__x); }
508   inline _GLIBCXX_CONSTEXPR long double
509   tan(long double __x)
510   { return __builtin_tanl(__x); }
511 #endif
513   template<typename _Tp>
514     inline _GLIBCXX_CONSTEXPR
515     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
516                                     double>::__type
517     tan(_Tp __x)
518     { return __builtin_tan(__x); }
520   using ::tanh;
522 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
523   inline _GLIBCXX_CONSTEXPR float
524   tanh(float __x)
525   { return __builtin_tanhf(__x); }
527   inline _GLIBCXX_CONSTEXPR long double
528   tanh(long double __x)
529   { return __builtin_tanhl(__x); }
530 #endif
532   template<typename _Tp>
533     inline _GLIBCXX_CONSTEXPR
534     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
535                                     double>::__type
536     tanh(_Tp __x)
537     { return __builtin_tanh(__x); }
539 _GLIBCXX_END_NAMESPACE_VERSION
540 } // namespace
542 #if _GLIBCXX_USE_C99_MATH
543 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
545 // These are possible macros imported from C99-land.
546 #undef fpclassify
547 #undef isfinite
548 #undef isinf
549 #undef isnan
550 #undef isnormal
551 #undef signbit
552 #undef isgreater
553 #undef isgreaterequal
554 #undef isless
555 #undef islessequal
556 #undef islessgreater
557 #undef isunordered
559 namespace std _GLIBCXX_VISIBILITY(default)
561 _GLIBCXX_BEGIN_NAMESPACE_VERSION
563 #if __cplusplus >= 201103L
565 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
566   constexpr int
567   fpclassify(float __x)
568   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
569                                 FP_SUBNORMAL, FP_ZERO, __x); }
571   constexpr int
572   fpclassify(double __x)
573   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
574                                 FP_SUBNORMAL, FP_ZERO, __x); }
576   constexpr int
577   fpclassify(long double __x)
578   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
579                                 FP_SUBNORMAL, FP_ZERO, __x); }
580 #endif
582   template<typename _Tp>
583     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
584                                               int>::__type
585     fpclassify(_Tp __x)
586     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
588 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
589   constexpr bool
590   isfinite(float __x)
591   { return __builtin_isfinite(__x); }
593   constexpr bool
594   isfinite(double __x)
595   { return __builtin_isfinite(__x); }
597   constexpr bool
598   isfinite(long double __x)
599   { return __builtin_isfinite(__x); }
600 #endif
602   template<typename _Tp>
603     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
604                                               bool>::__type
605     isfinite(_Tp __x)
606     { return true; }
608 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
609   constexpr bool
610   isinf(float __x)
611   { return __builtin_isinf(__x); }
613 #ifdef _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN
614   using ::isinf;
615 #else
616   constexpr bool
617   isinf(double __x)
618   { return __builtin_isinf(__x); }
619 #endif
621   constexpr bool
622   isinf(long double __x)
623   { return __builtin_isinf(__x); }
624 #endif
626   template<typename _Tp>
627     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
628                                               bool>::__type
629     isinf(_Tp __x)
630     { return false; }
632 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
633   constexpr bool
634   isnan(float __x)
635   { return __builtin_isnan(__x); }
637 #ifdef _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN
638   using ::isnan;
639 #else
640   constexpr bool
641   isnan(double __x)
642   { return __builtin_isnan(__x); }
643 #endif
645   constexpr bool
646   isnan(long double __x)
647   { return __builtin_isnan(__x); }
648 #endif
650   template<typename _Tp>
651     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
652                                               bool>::__type
653     isnan(_Tp __x)
654     { return false; }
656 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
657   constexpr bool
658   isnormal(float __x)
659   { return __builtin_isnormal(__x); }
661   constexpr bool
662   isnormal(double __x)
663   { return __builtin_isnormal(__x); }
665   constexpr bool
666   isnormal(long double __x)
667   { return __builtin_isnormal(__x); }
668 #endif
670   template<typename _Tp>
671     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
672                                               bool>::__type
673     isnormal(_Tp __x)
674     { return __x != 0 ? true : false; }
676 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
677   // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic.
678   constexpr bool
679   signbit(float __x)
680   { return __builtin_signbit(__x); }
682   constexpr bool
683   signbit(double __x)
684   { return __builtin_signbit(__x); }
686   constexpr bool
687   signbit(long double __x)
688   { return __builtin_signbit(__x); }
689 #endif
691   template<typename _Tp>
692     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
693                                               bool>::__type
694     signbit(_Tp __x)
695     { return __x < 0 ? true : false; }
697 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
698   constexpr bool
699   isgreater(float __x, float __y)
700   { return __builtin_isgreater(__x, __y); }
702   constexpr bool
703   isgreater(double __x, double __y)
704   { return __builtin_isgreater(__x, __y); }
706   constexpr bool
707   isgreater(long double __x, long double __y)
708   { return __builtin_isgreater(__x, __y); }
709 #endif
711   template<typename _Tp, typename _Up>
712     constexpr typename
713     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
714                             && __is_arithmetic<_Up>::__value), bool>::__type
715     isgreater(_Tp __x, _Up __y)
716     {
717       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
718       return __builtin_isgreater(__type(__x), __type(__y));
719     }
721 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
722   constexpr bool
723   isgreaterequal(float __x, float __y)
724   { return __builtin_isgreaterequal(__x, __y); }
726   constexpr bool
727   isgreaterequal(double __x, double __y)
728   { return __builtin_isgreaterequal(__x, __y); }
730   constexpr bool
731   isgreaterequal(long double __x, long double __y)
732   { return __builtin_isgreaterequal(__x, __y); }
733 #endif
735   template<typename _Tp, typename _Up>
736     constexpr typename
737     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
738                             && __is_arithmetic<_Up>::__value), bool>::__type
739     isgreaterequal(_Tp __x, _Up __y)
740     {
741       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
742       return __builtin_isgreaterequal(__type(__x), __type(__y));
743     }
745 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
746   constexpr bool
747   isless(float __x, float __y)
748   { return __builtin_isless(__x, __y); }
750   constexpr bool
751   isless(double __x, double __y)
752   { return __builtin_isless(__x, __y); }
754   constexpr bool
755   isless(long double __x, long double __y)
756   { return __builtin_isless(__x, __y); }
757 #endif
759   template<typename _Tp, typename _Up>
760     constexpr typename
761     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
762                             && __is_arithmetic<_Up>::__value), bool>::__type
763     isless(_Tp __x, _Up __y)
764     {
765       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
766       return __builtin_isless(__type(__x), __type(__y));
767     }
769 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
770   constexpr bool
771   islessequal(float __x, float __y)
772   { return __builtin_islessequal(__x, __y); }
774   constexpr bool
775   islessequal(double __x, double __y)
776   { return __builtin_islessequal(__x, __y); }
778   constexpr bool
779   islessequal(long double __x, long double __y)
780   { return __builtin_islessequal(__x, __y); }
781 #endif
783   template<typename _Tp, typename _Up>
784     constexpr typename
785     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
786                             && __is_arithmetic<_Up>::__value), bool>::__type
787     islessequal(_Tp __x, _Up __y)
788     {
789       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
790       return __builtin_islessequal(__type(__x), __type(__y));
791     }
793 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
794   constexpr bool
795   islessgreater(float __x, float __y)
796   { return __builtin_islessgreater(__x, __y); }
798   constexpr bool
799   islessgreater(double __x, double __y)
800   { return __builtin_islessgreater(__x, __y); }
802   constexpr bool
803   islessgreater(long double __x, long double __y)
804   { return __builtin_islessgreater(__x, __y); }
805 #endif
807   template<typename _Tp, typename _Up>
808     constexpr typename
809     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
810                             && __is_arithmetic<_Up>::__value), bool>::__type
811     islessgreater(_Tp __x, _Up __y)
812     {
813       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
814       return __builtin_islessgreater(__type(__x), __type(__y));
815     }
817 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
818   constexpr bool
819   isunordered(float __x, float __y)
820   { return __builtin_isunordered(__x, __y); }
822   constexpr bool
823   isunordered(double __x, double __y)
824   { return __builtin_isunordered(__x, __y); }
826   constexpr bool
827   isunordered(long double __x, long double __y)
828   { return __builtin_isunordered(__x, __y); }
829 #endif
831   template<typename _Tp, typename _Up>
832     constexpr typename
833     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
834                             && __is_arithmetic<_Up>::__value), bool>::__type
835     isunordered(_Tp __x, _Up __y)
836     {
837       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
838       return __builtin_isunordered(__type(__x), __type(__y));
839     }
841 #else
843   template<typename _Tp>
844     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
845                                            int>::__type
846     fpclassify(_Tp __f)
847     {
848       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
849       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
850                                   FP_SUBNORMAL, FP_ZERO, __type(__f));
851     }
853   template<typename _Tp>
854     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
855                                            int>::__type
856     isfinite(_Tp __f)
857     {
858       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
859       return __builtin_isfinite(__type(__f));
860     }
862   template<typename _Tp>
863     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
864                                            int>::__type
865     isinf(_Tp __f)
866     {
867       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
868       return __builtin_isinf(__type(__f));
869     }
871   template<typename _Tp>
872     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
873                                            int>::__type
874     isnan(_Tp __f)
875     {
876       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
877       return __builtin_isnan(__type(__f));
878     }
880   template<typename _Tp>
881     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
882                                            int>::__type
883     isnormal(_Tp __f)
884     {
885       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
886       return __builtin_isnormal(__type(__f));
887     }
889   template<typename _Tp>
890     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
891                                            int>::__type
892     signbit(_Tp __f)
893     {
894       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
895       return __builtin_signbit(__type(__f));
896     }
898   template<typename _Tp>
899     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
900                                            int>::__type
901     isgreater(_Tp __f1, _Tp __f2)
902     {
903       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
904       return __builtin_isgreater(__type(__f1), __type(__f2));
905     }
907   template<typename _Tp>
908     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
909                                            int>::__type
910     isgreaterequal(_Tp __f1, _Tp __f2)
911     {
912       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
913       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
914     }
916   template<typename _Tp>
917     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
918                                            int>::__type
919     isless(_Tp __f1, _Tp __f2)
920     {
921       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
922       return __builtin_isless(__type(__f1), __type(__f2));
923     }
925   template<typename _Tp>
926     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
927                                            int>::__type
928     islessequal(_Tp __f1, _Tp __f2)
929     {
930       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
931       return __builtin_islessequal(__type(__f1), __type(__f2));
932     }
934   template<typename _Tp>
935     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
936                                            int>::__type
937     islessgreater(_Tp __f1, _Tp __f2)
938     {
939       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
940       return __builtin_islessgreater(__type(__f1), __type(__f2));
941     }
943   template<typename _Tp>
944     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
945                                            int>::__type
946     isunordered(_Tp __f1, _Tp __f2)
947     {
948       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
949       return __builtin_isunordered(__type(__f1), __type(__f2));
950     }
952 #endif
954 _GLIBCXX_END_NAMESPACE_VERSION
955 } // namespace
957 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
958 #endif
960 #if __cplusplus >= 201103L
962 #ifdef _GLIBCXX_USE_C99_MATH_TR1
964 #undef acosh
965 #undef acoshf
966 #undef acoshl
967 #undef asinh
968 #undef asinhf
969 #undef asinhl
970 #undef atanh
971 #undef atanhf
972 #undef atanhl
973 #undef cbrt
974 #undef cbrtf
975 #undef cbrtl
976 #undef copysign
977 #undef copysignf
978 #undef copysignl
979 #undef erf
980 #undef erff
981 #undef erfl
982 #undef erfc
983 #undef erfcf
984 #undef erfcl
985 #undef exp2
986 #undef exp2f
987 #undef exp2l
988 #undef expm1
989 #undef expm1f
990 #undef expm1l
991 #undef fdim
992 #undef fdimf
993 #undef fdiml
994 #undef fma
995 #undef fmaf
996 #undef fmal
997 #undef fmax
998 #undef fmaxf
999 #undef fmaxl
1000 #undef fmin
1001 #undef fminf
1002 #undef fminl
1003 #undef hypot
1004 #undef hypotf
1005 #undef hypotl
1006 #undef ilogb
1007 #undef ilogbf
1008 #undef ilogbl
1009 #undef lgamma
1010 #undef lgammaf
1011 #undef lgammal
1012 #undef llrint
1013 #undef llrintf
1014 #undef llrintl
1015 #undef llround
1016 #undef llroundf
1017 #undef llroundl
1018 #undef log1p
1019 #undef log1pf
1020 #undef log1pl
1021 #undef log2
1022 #undef log2f
1023 #undef log2l
1024 #undef logb
1025 #undef logbf
1026 #undef logbl
1027 #undef lrint
1028 #undef lrintf
1029 #undef lrintl
1030 #undef lround
1031 #undef lroundf
1032 #undef lroundl
1033 #undef nan
1034 #undef nanf
1035 #undef nanl
1036 #undef nearbyint
1037 #undef nearbyintf
1038 #undef nearbyintl
1039 #undef nextafter
1040 #undef nextafterf
1041 #undef nextafterl
1042 #undef nexttoward
1043 #undef nexttowardf
1044 #undef nexttowardl
1045 #undef remainder
1046 #undef remainderf
1047 #undef remainderl
1048 #undef remquo
1049 #undef remquof
1050 #undef remquol
1051 #undef rint
1052 #undef rintf
1053 #undef rintl
1054 #undef round
1055 #undef roundf
1056 #undef roundl
1057 #undef scalbln
1058 #undef scalblnf
1059 #undef scalblnl
1060 #undef scalbn
1061 #undef scalbnf
1062 #undef scalbnl
1063 #undef tgamma
1064 #undef tgammaf
1065 #undef tgammal
1066 #undef trunc
1067 #undef truncf
1068 #undef truncl
1070 namespace std _GLIBCXX_VISIBILITY(default)
1072 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1074   // types
1075   using ::double_t;
1076   using ::float_t;
1078   // functions
1079   using ::acosh;
1080   using ::acoshf;
1081   using ::acoshl;
1083   using ::asinh;
1084   using ::asinhf;
1085   using ::asinhl;
1087   using ::atanh;
1088   using ::atanhf;
1089   using ::atanhl;
1091   using ::cbrt;
1092   using ::cbrtf;
1093   using ::cbrtl;
1095   using ::copysign;
1096   using ::copysignf;
1097   using ::copysignl;
1099   using ::erf;
1100   using ::erff;
1101   using ::erfl;
1103   using ::erfc;
1104   using ::erfcf;
1105   using ::erfcl;
1107   using ::exp2;
1108   using ::exp2f;
1109   using ::exp2l;
1111   using ::expm1;
1112   using ::expm1f;
1113   using ::expm1l;
1115   using ::fdim;
1116   using ::fdimf;
1117   using ::fdiml;
1119   using ::fma;
1120   using ::fmaf;
1121   using ::fmal;
1123   using ::fmax;
1124   using ::fmaxf;
1125   using ::fmaxl;
1127   using ::fmin;
1128   using ::fminf;
1129   using ::fminl;
1131   using ::hypot;
1132   using ::hypotf;
1133   using ::hypotl;
1135   using ::ilogb;
1136   using ::ilogbf;
1137   using ::ilogbl;
1139   using ::lgamma;
1140   using ::lgammaf;
1141   using ::lgammal;
1143   using ::llrint;
1144   using ::llrintf;
1145   using ::llrintl;
1147   using ::llround;
1148   using ::llroundf;
1149   using ::llroundl;
1151   using ::log1p;
1152   using ::log1pf;
1153   using ::log1pl;
1155   using ::log2;
1156   using ::log2f;
1157   using ::log2l;
1159   using ::logb;
1160   using ::logbf;
1161   using ::logbl;
1163   using ::lrint;
1164   using ::lrintf;
1165   using ::lrintl;
1167   using ::lround;
1168   using ::lroundf;
1169   using ::lroundl;
1171   using ::nan;
1172   using ::nanf;
1173   using ::nanl;
1175   using ::nearbyint;
1176   using ::nearbyintf;
1177   using ::nearbyintl;
1179   using ::nextafter;
1180   using ::nextafterf;
1181   using ::nextafterl;
1183   using ::nexttoward;
1184   using ::nexttowardf;
1185   using ::nexttowardl;
1187   using ::remainder;
1188   using ::remainderf;
1189   using ::remainderl;
1191   using ::remquo;
1192   using ::remquof;
1193   using ::remquol;
1195   using ::rint;
1196   using ::rintf;
1197   using ::rintl;
1199   using ::round;
1200   using ::roundf;
1201   using ::roundl;
1203   using ::scalbln;
1204   using ::scalblnf;
1205   using ::scalblnl;
1207   using ::scalbn;
1208   using ::scalbnf;
1209   using ::scalbnl;
1211   using ::tgamma;
1212   using ::tgammaf;
1213   using ::tgammal;
1215   using ::trunc;
1216   using ::truncf;
1217   using ::truncl;
1219   /// Additional overloads.
1220 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1221   constexpr float
1222   acosh(float __x)
1223   { return __builtin_acoshf(__x); }
1225   constexpr long double
1226   acosh(long double __x)
1227   { return __builtin_acoshl(__x); }
1228 #endif
1230   template<typename _Tp>
1231     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1232                                               double>::__type
1233     acosh(_Tp __x)
1234     { return __builtin_acosh(__x); }
1236 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1237   constexpr float
1238   asinh(float __x)
1239   { return __builtin_asinhf(__x); }
1241   constexpr long double
1242   asinh(long double __x)
1243   { return __builtin_asinhl(__x); }
1244 #endif
1246   template<typename _Tp>
1247     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1248                                               double>::__type
1249     asinh(_Tp __x)
1250     { return __builtin_asinh(__x); }
1252 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1253   constexpr float
1254   atanh(float __x)
1255   { return __builtin_atanhf(__x); }
1257   constexpr long double
1258   atanh(long double __x)
1259   { return __builtin_atanhl(__x); }
1260 #endif
1262   template<typename _Tp>
1263     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1264                                               double>::__type
1265     atanh(_Tp __x)
1266     { return __builtin_atanh(__x); }
1268 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1269   constexpr float
1270   cbrt(float __x)
1271   { return __builtin_cbrtf(__x); }
1273   constexpr long double
1274   cbrt(long double __x)
1275   { return __builtin_cbrtl(__x); }
1276 #endif
1278   template<typename _Tp>
1279     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1280                                               double>::__type
1281     cbrt(_Tp __x)
1282     { return __builtin_cbrt(__x); }
1284 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1285   constexpr float
1286   copysign(float __x, float __y)
1287   { return __builtin_copysignf(__x, __y); }
1289   constexpr long double
1290   copysign(long double __x, long double __y)
1291   { return __builtin_copysignl(__x, __y); }
1292 #endif
1294   template<typename _Tp, typename _Up>
1295     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1296     copysign(_Tp __x, _Up __y)
1297     {
1298       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1299       return copysign(__type(__x), __type(__y));
1300     }
1302 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1303   constexpr float
1304   erf(float __x)
1305   { return __builtin_erff(__x); }
1307   constexpr long double
1308   erf(long double __x)
1309   { return __builtin_erfl(__x); }
1310 #endif
1312   template<typename _Tp>
1313     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1314                                               double>::__type
1315     erf(_Tp __x)
1316     { return __builtin_erf(__x); }
1318 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1319   constexpr float
1320   erfc(float __x)
1321   { return __builtin_erfcf(__x); }
1323   constexpr long double
1324   erfc(long double __x)
1325   { return __builtin_erfcl(__x); }
1326 #endif
1328   template<typename _Tp>
1329     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1330                                               double>::__type
1331     erfc(_Tp __x)
1332     { return __builtin_erfc(__x); }
1334 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1335   constexpr float
1336   exp2(float __x)
1337   { return __builtin_exp2f(__x); }
1339   constexpr long double
1340   exp2(long double __x)
1341   { return __builtin_exp2l(__x); }
1342 #endif
1344   template<typename _Tp>
1345     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1346                                               double>::__type
1347     exp2(_Tp __x)
1348     { return __builtin_exp2(__x); }
1350 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1351   constexpr float
1352   expm1(float __x)
1353   { return __builtin_expm1f(__x); }
1355   constexpr long double
1356   expm1(long double __x)
1357   { return __builtin_expm1l(__x); }
1358 #endif
1360   template<typename _Tp>
1361     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1362                                               double>::__type
1363     expm1(_Tp __x)
1364     { return __builtin_expm1(__x); }
1366 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1367   constexpr float
1368   fdim(float __x, float __y)
1369   { return __builtin_fdimf(__x, __y); }
1371   constexpr long double
1372   fdim(long double __x, long double __y)
1373   { return __builtin_fdiml(__x, __y); }
1374 #endif
1376   template<typename _Tp, typename _Up>
1377     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1378     fdim(_Tp __x, _Up __y)
1379     {
1380       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1381       return fdim(__type(__x), __type(__y));
1382     }
1384 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1385   constexpr float
1386   fma(float __x, float __y, float __z)
1387   { return __builtin_fmaf(__x, __y, __z); }
1389   constexpr long double
1390   fma(long double __x, long double __y, long double __z)
1391   { return __builtin_fmal(__x, __y, __z); }
1392 #endif
1394   template<typename _Tp, typename _Up, typename _Vp>
1395     constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
1396     fma(_Tp __x, _Up __y, _Vp __z)
1397     {
1398       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1399       return fma(__type(__x), __type(__y), __type(__z));
1400     }
1402 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1403   constexpr float
1404   fmax(float __x, float __y)
1405   { return __builtin_fmaxf(__x, __y); }
1407   constexpr long double
1408   fmax(long double __x, long double __y)
1409   { return __builtin_fmaxl(__x, __y); }
1410 #endif
1412   template<typename _Tp, typename _Up>
1413     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1414     fmax(_Tp __x, _Up __y)
1415     {
1416       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1417       return fmax(__type(__x), __type(__y));
1418     }
1420 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1421   constexpr float
1422   fmin(float __x, float __y)
1423   { return __builtin_fminf(__x, __y); }
1425   constexpr long double
1426   fmin(long double __x, long double __y)
1427   { return __builtin_fminl(__x, __y); }
1428 #endif
1430   template<typename _Tp, typename _Up>
1431     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1432     fmin(_Tp __x, _Up __y)
1433     {
1434       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1435       return fmin(__type(__x), __type(__y));
1436     }
1438 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1439   constexpr float
1440   hypot(float __x, float __y)
1441   { return __builtin_hypotf(__x, __y); }
1443   constexpr long double
1444   hypot(long double __x, long double __y)
1445   { return __builtin_hypotl(__x, __y); }
1446 #endif
1448   template<typename _Tp, typename _Up>
1449     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1450     hypot(_Tp __x, _Up __y)
1451     {
1452       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1453       return hypot(__type(__x), __type(__y));
1454     }
1456 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1457   constexpr int
1458   ilogb(float __x)
1459   { return __builtin_ilogbf(__x); }
1461   constexpr int
1462   ilogb(long double __x)
1463   { return __builtin_ilogbl(__x); }
1464 #endif
1466   template<typename _Tp>
1467     constexpr
1468     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1469                                     int>::__type
1470     ilogb(_Tp __x)
1471     { return __builtin_ilogb(__x); }
1473 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1474   constexpr float
1475   lgamma(float __x)
1476   { return __builtin_lgammaf(__x); }
1478   constexpr long double
1479   lgamma(long double __x)
1480   { return __builtin_lgammal(__x); }
1481 #endif
1483   template<typename _Tp>
1484     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1485                                               double>::__type
1486     lgamma(_Tp __x)
1487     { return __builtin_lgamma(__x); }
1489 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1490   constexpr long long
1491   llrint(float __x)
1492   { return __builtin_llrintf(__x); }
1494   constexpr long long
1495   llrint(long double __x)
1496   { return __builtin_llrintl(__x); }
1497 #endif
1499   template<typename _Tp>
1500     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1501                                               long long>::__type
1502     llrint(_Tp __x)
1503     { return __builtin_llrint(__x); }
1505 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1506   constexpr long long
1507   llround(float __x)
1508   { return __builtin_llroundf(__x); }
1510   constexpr long long
1511   llround(long double __x)
1512   { return __builtin_llroundl(__x); }
1513 #endif
1515   template<typename _Tp>
1516     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1517                                               long long>::__type
1518     llround(_Tp __x)
1519     { return __builtin_llround(__x); }
1521 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1522   constexpr float
1523   log1p(float __x)
1524   { return __builtin_log1pf(__x); }
1526   constexpr long double
1527   log1p(long double __x)
1528   { return __builtin_log1pl(__x); }
1529 #endif
1531   template<typename _Tp>
1532     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1533                                               double>::__type
1534     log1p(_Tp __x)
1535     { return __builtin_log1p(__x); }
1537 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1538   // DR 568.
1539   constexpr float
1540   log2(float __x)
1541   { return __builtin_log2f(__x); }
1543   constexpr long double
1544   log2(long double __x)
1545   { return __builtin_log2l(__x); }
1546 #endif
1548   template<typename _Tp>
1549     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1550                                               double>::__type
1551     log2(_Tp __x)
1552     { return __builtin_log2(__x); }
1554 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1555   constexpr float
1556   logb(float __x)
1557   { return __builtin_logbf(__x); }
1559   constexpr long double
1560   logb(long double __x)
1561   { return __builtin_logbl(__x); }
1562 #endif
1564   template<typename _Tp>
1565     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1566                                               double>::__type
1567     logb(_Tp __x)
1568     { return __builtin_logb(__x); }
1570 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1571   constexpr long
1572   lrint(float __x)
1573   { return __builtin_lrintf(__x); }
1575   constexpr long
1576   lrint(long double __x)
1577   { return __builtin_lrintl(__x); }
1578 #endif
1580   template<typename _Tp>
1581     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1582                                               long>::__type
1583     lrint(_Tp __x)
1584     { return __builtin_lrint(__x); }
1586 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1587   constexpr long
1588   lround(float __x)
1589   { return __builtin_lroundf(__x); }
1591   constexpr long
1592   lround(long double __x)
1593   { return __builtin_lroundl(__x); }
1594 #endif
1596   template<typename _Tp>
1597     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1598                                               long>::__type
1599     lround(_Tp __x)
1600     { return __builtin_lround(__x); }
1602 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1603   constexpr float
1604   nearbyint(float __x)
1605   { return __builtin_nearbyintf(__x); }
1607   constexpr long double
1608   nearbyint(long double __x)
1609   { return __builtin_nearbyintl(__x); }
1610 #endif
1612   template<typename _Tp>
1613     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1614                                               double>::__type
1615     nearbyint(_Tp __x)
1616     { return __builtin_nearbyint(__x); }
1618 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1619   constexpr float
1620   nextafter(float __x, float __y)
1621   { return __builtin_nextafterf(__x, __y); }
1623   constexpr long double
1624   nextafter(long double __x, long double __y)
1625   { return __builtin_nextafterl(__x, __y); }
1626 #endif
1628   template<typename _Tp, typename _Up>
1629     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1630     nextafter(_Tp __x, _Up __y)
1631     {
1632       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1633       return nextafter(__type(__x), __type(__y));
1634     }
1636 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1637   constexpr float
1638   nexttoward(float __x, long double __y)
1639   { return __builtin_nexttowardf(__x, __y); }
1641   constexpr long double
1642   nexttoward(long double __x, long double __y)
1643   { return __builtin_nexttowardl(__x, __y); }
1644 #endif
1646   template<typename _Tp>
1647     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1648                                               double>::__type
1649     nexttoward(_Tp __x, long double __y)
1650     { return __builtin_nexttoward(__x, __y); }
1652 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1653   constexpr float
1654   remainder(float __x, float __y)
1655   { return __builtin_remainderf(__x, __y); }
1657   constexpr long double
1658   remainder(long double __x, long double __y)
1659   { return __builtin_remainderl(__x, __y); }
1660 #endif
1662   template<typename _Tp, typename _Up>
1663     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1664     remainder(_Tp __x, _Up __y)
1665     {
1666       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1667       return remainder(__type(__x), __type(__y));
1668     }
1670 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1671   inline float
1672   remquo(float __x, float __y, int* __pquo)
1673   { return __builtin_remquof(__x, __y, __pquo); }
1675   inline long double
1676   remquo(long double __x, long double __y, int* __pquo)
1677   { return __builtin_remquol(__x, __y, __pquo); }
1678 #endif
1680   template<typename _Tp, typename _Up>
1681     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1682     remquo(_Tp __x, _Up __y, int* __pquo)
1683     {
1684       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1685       return remquo(__type(__x), __type(__y), __pquo);
1686     }
1688 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1689   constexpr float
1690   rint(float __x)
1691   { return __builtin_rintf(__x); }
1693   constexpr long double
1694   rint(long double __x)
1695   { return __builtin_rintl(__x); }
1696 #endif
1698   template<typename _Tp>
1699     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1700                                               double>::__type
1701     rint(_Tp __x)
1702     { return __builtin_rint(__x); }
1704 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1705   constexpr float
1706   round(float __x)
1707   { return __builtin_roundf(__x); }
1709   constexpr long double
1710   round(long double __x)
1711   { return __builtin_roundl(__x); }
1712 #endif
1714   template<typename _Tp>
1715     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1716                                               double>::__type
1717     round(_Tp __x)
1718     { return __builtin_round(__x); }
1720 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1721   constexpr float
1722   scalbln(float __x, long __ex)
1723   { return __builtin_scalblnf(__x, __ex); }
1725   constexpr long double
1726   scalbln(long double __x, long __ex)
1727   { return __builtin_scalblnl(__x, __ex); }
1728 #endif
1730   template<typename _Tp>
1731     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1732                                               double>::__type
1733     scalbln(_Tp __x, long __ex)
1734     { return __builtin_scalbln(__x, __ex); }
1736 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1737   constexpr float
1738   scalbn(float __x, int __ex)
1739   { return __builtin_scalbnf(__x, __ex); }
1741   constexpr long double
1742   scalbn(long double __x, int __ex)
1743   { return __builtin_scalbnl(__x, __ex); }
1744 #endif
1746   template<typename _Tp>
1747     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1748                                               double>::__type
1749     scalbn(_Tp __x, int __ex)
1750     { return __builtin_scalbn(__x, __ex); }
1752 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1753   constexpr float
1754   tgamma(float __x)
1755   { return __builtin_tgammaf(__x); }
1757   constexpr long double
1758   tgamma(long double __x)
1759   { return __builtin_tgammal(__x); }
1760 #endif
1762   template<typename _Tp>
1763     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1764                                               double>::__type
1765     tgamma(_Tp __x)
1766     { return __builtin_tgamma(__x); }
1768 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1769   constexpr float
1770   trunc(float __x)
1771   { return __builtin_truncf(__x); }
1773   constexpr long double
1774   trunc(long double __x)
1775   { return __builtin_truncl(__x); }
1776 #endif
1778   template<typename _Tp>
1779     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1780                                               double>::__type
1781     trunc(_Tp __x)
1782     { return __builtin_trunc(__x); }
1784 _GLIBCXX_END_NAMESPACE_VERSION
1785 } // namespace
1787 #endif // _GLIBCXX_USE_C99_MATH_TR1
1789 #endif // C++11
1791 #if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
1792 #  include <bits/specfun.h>
1793 #endif
1795 } // extern "C++"
1797 #endif