PR libstdc++/69450
[official-gcc.git] / libstdc++-v3 / include / c_global / cmath
blob6a24ebfec5b84922ec6ebc4da5d3d2e50a1758a6
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 #if _GLIBCXX_HAVE_OBSOLETE_ISINF \
614   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
615   using ::isinf;
616 #else
617   constexpr bool
618   isinf(double __x)
619   { return __builtin_isinf(__x); }
620 #endif
622   constexpr bool
623   isinf(long double __x)
624   { return __builtin_isinf(__x); }
625 #endif
627   template<typename _Tp>
628     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
629                                               bool>::__type
630     isinf(_Tp __x)
631     { return false; }
633 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
634   constexpr bool
635   isnan(float __x)
636   { return __builtin_isnan(__x); }
638 #if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
639   && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
640   using ::isnan;
641 #else
642   constexpr bool
643   isnan(double __x)
644   { return __builtin_isnan(__x); }
645 #endif
647   constexpr bool
648   isnan(long double __x)
649   { return __builtin_isnan(__x); }
650 #endif
652   template<typename _Tp>
653     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
654                                               bool>::__type
655     isnan(_Tp __x)
656     { return false; }
658 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
659   constexpr bool
660   isnormal(float __x)
661   { return __builtin_isnormal(__x); }
663   constexpr bool
664   isnormal(double __x)
665   { return __builtin_isnormal(__x); }
667   constexpr bool
668   isnormal(long double __x)
669   { return __builtin_isnormal(__x); }
670 #endif
672   template<typename _Tp>
673     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
674                                               bool>::__type
675     isnormal(_Tp __x)
676     { return __x != 0 ? true : false; }
678 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
679   // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic.
680   constexpr bool
681   signbit(float __x)
682   { return __builtin_signbit(__x); }
684   constexpr bool
685   signbit(double __x)
686   { return __builtin_signbit(__x); }
688   constexpr bool
689   signbit(long double __x)
690   { return __builtin_signbit(__x); }
691 #endif
693   template<typename _Tp>
694     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
695                                               bool>::__type
696     signbit(_Tp __x)
697     { return __x < 0 ? true : false; }
699 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
700   constexpr bool
701   isgreater(float __x, float __y)
702   { return __builtin_isgreater(__x, __y); }
704   constexpr bool
705   isgreater(double __x, double __y)
706   { return __builtin_isgreater(__x, __y); }
708   constexpr bool
709   isgreater(long double __x, long double __y)
710   { return __builtin_isgreater(__x, __y); }
711 #endif
713   template<typename _Tp, typename _Up>
714     constexpr typename
715     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
716                             && __is_arithmetic<_Up>::__value), bool>::__type
717     isgreater(_Tp __x, _Up __y)
718     {
719       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
720       return __builtin_isgreater(__type(__x), __type(__y));
721     }
723 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
724   constexpr bool
725   isgreaterequal(float __x, float __y)
726   { return __builtin_isgreaterequal(__x, __y); }
728   constexpr bool
729   isgreaterequal(double __x, double __y)
730   { return __builtin_isgreaterequal(__x, __y); }
732   constexpr bool
733   isgreaterequal(long double __x, long double __y)
734   { return __builtin_isgreaterequal(__x, __y); }
735 #endif
737   template<typename _Tp, typename _Up>
738     constexpr typename
739     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
740                             && __is_arithmetic<_Up>::__value), bool>::__type
741     isgreaterequal(_Tp __x, _Up __y)
742     {
743       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
744       return __builtin_isgreaterequal(__type(__x), __type(__y));
745     }
747 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
748   constexpr bool
749   isless(float __x, float __y)
750   { return __builtin_isless(__x, __y); }
752   constexpr bool
753   isless(double __x, double __y)
754   { return __builtin_isless(__x, __y); }
756   constexpr bool
757   isless(long double __x, long double __y)
758   { return __builtin_isless(__x, __y); }
759 #endif
761   template<typename _Tp, typename _Up>
762     constexpr typename
763     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
764                             && __is_arithmetic<_Up>::__value), bool>::__type
765     isless(_Tp __x, _Up __y)
766     {
767       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
768       return __builtin_isless(__type(__x), __type(__y));
769     }
771 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
772   constexpr bool
773   islessequal(float __x, float __y)
774   { return __builtin_islessequal(__x, __y); }
776   constexpr bool
777   islessequal(double __x, double __y)
778   { return __builtin_islessequal(__x, __y); }
780   constexpr bool
781   islessequal(long double __x, long double __y)
782   { return __builtin_islessequal(__x, __y); }
783 #endif
785   template<typename _Tp, typename _Up>
786     constexpr typename
787     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
788                             && __is_arithmetic<_Up>::__value), bool>::__type
789     islessequal(_Tp __x, _Up __y)
790     {
791       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
792       return __builtin_islessequal(__type(__x), __type(__y));
793     }
795 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
796   constexpr bool
797   islessgreater(float __x, float __y)
798   { return __builtin_islessgreater(__x, __y); }
800   constexpr bool
801   islessgreater(double __x, double __y)
802   { return __builtin_islessgreater(__x, __y); }
804   constexpr bool
805   islessgreater(long double __x, long double __y)
806   { return __builtin_islessgreater(__x, __y); }
807 #endif
809   template<typename _Tp, typename _Up>
810     constexpr typename
811     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
812                             && __is_arithmetic<_Up>::__value), bool>::__type
813     islessgreater(_Tp __x, _Up __y)
814     {
815       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
816       return __builtin_islessgreater(__type(__x), __type(__y));
817     }
819 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
820   constexpr bool
821   isunordered(float __x, float __y)
822   { return __builtin_isunordered(__x, __y); }
824   constexpr bool
825   isunordered(double __x, double __y)
826   { return __builtin_isunordered(__x, __y); }
828   constexpr bool
829   isunordered(long double __x, long double __y)
830   { return __builtin_isunordered(__x, __y); }
831 #endif
833   template<typename _Tp, typename _Up>
834     constexpr typename
835     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
836                             && __is_arithmetic<_Up>::__value), bool>::__type
837     isunordered(_Tp __x, _Up __y)
838     {
839       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
840       return __builtin_isunordered(__type(__x), __type(__y));
841     }
843 #else
845   template<typename _Tp>
846     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
847                                            int>::__type
848     fpclassify(_Tp __f)
849     {
850       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
851       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
852                                   FP_SUBNORMAL, FP_ZERO, __type(__f));
853     }
855   template<typename _Tp>
856     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
857                                            int>::__type
858     isfinite(_Tp __f)
859     {
860       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
861       return __builtin_isfinite(__type(__f));
862     }
864   template<typename _Tp>
865     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
866                                            int>::__type
867     isinf(_Tp __f)
868     {
869       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
870       return __builtin_isinf(__type(__f));
871     }
873   template<typename _Tp>
874     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
875                                            int>::__type
876     isnan(_Tp __f)
877     {
878       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
879       return __builtin_isnan(__type(__f));
880     }
882   template<typename _Tp>
883     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
884                                            int>::__type
885     isnormal(_Tp __f)
886     {
887       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
888       return __builtin_isnormal(__type(__f));
889     }
891   template<typename _Tp>
892     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
893                                            int>::__type
894     signbit(_Tp __f)
895     {
896       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
897       return __builtin_signbit(__type(__f));
898     }
900   template<typename _Tp>
901     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
902                                            int>::__type
903     isgreater(_Tp __f1, _Tp __f2)
904     {
905       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
906       return __builtin_isgreater(__type(__f1), __type(__f2));
907     }
909   template<typename _Tp>
910     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
911                                            int>::__type
912     isgreaterequal(_Tp __f1, _Tp __f2)
913     {
914       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
915       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
916     }
918   template<typename _Tp>
919     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
920                                            int>::__type
921     isless(_Tp __f1, _Tp __f2)
922     {
923       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
924       return __builtin_isless(__type(__f1), __type(__f2));
925     }
927   template<typename _Tp>
928     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
929                                            int>::__type
930     islessequal(_Tp __f1, _Tp __f2)
931     {
932       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
933       return __builtin_islessequal(__type(__f1), __type(__f2));
934     }
936   template<typename _Tp>
937     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
938                                            int>::__type
939     islessgreater(_Tp __f1, _Tp __f2)
940     {
941       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
942       return __builtin_islessgreater(__type(__f1), __type(__f2));
943     }
945   template<typename _Tp>
946     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
947                                            int>::__type
948     isunordered(_Tp __f1, _Tp __f2)
949     {
950       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
951       return __builtin_isunordered(__type(__f1), __type(__f2));
952     }
954 #endif
956 _GLIBCXX_END_NAMESPACE_VERSION
957 } // namespace
959 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
960 #endif
962 #if __cplusplus >= 201103L
964 #ifdef _GLIBCXX_USE_C99_MATH_TR1
966 #undef acosh
967 #undef acoshf
968 #undef acoshl
969 #undef asinh
970 #undef asinhf
971 #undef asinhl
972 #undef atanh
973 #undef atanhf
974 #undef atanhl
975 #undef cbrt
976 #undef cbrtf
977 #undef cbrtl
978 #undef copysign
979 #undef copysignf
980 #undef copysignl
981 #undef erf
982 #undef erff
983 #undef erfl
984 #undef erfc
985 #undef erfcf
986 #undef erfcl
987 #undef exp2
988 #undef exp2f
989 #undef exp2l
990 #undef expm1
991 #undef expm1f
992 #undef expm1l
993 #undef fdim
994 #undef fdimf
995 #undef fdiml
996 #undef fma
997 #undef fmaf
998 #undef fmal
999 #undef fmax
1000 #undef fmaxf
1001 #undef fmaxl
1002 #undef fmin
1003 #undef fminf
1004 #undef fminl
1005 #undef hypot
1006 #undef hypotf
1007 #undef hypotl
1008 #undef ilogb
1009 #undef ilogbf
1010 #undef ilogbl
1011 #undef lgamma
1012 #undef lgammaf
1013 #undef lgammal
1014 #undef llrint
1015 #undef llrintf
1016 #undef llrintl
1017 #undef llround
1018 #undef llroundf
1019 #undef llroundl
1020 #undef log1p
1021 #undef log1pf
1022 #undef log1pl
1023 #undef log2
1024 #undef log2f
1025 #undef log2l
1026 #undef logb
1027 #undef logbf
1028 #undef logbl
1029 #undef lrint
1030 #undef lrintf
1031 #undef lrintl
1032 #undef lround
1033 #undef lroundf
1034 #undef lroundl
1035 #undef nan
1036 #undef nanf
1037 #undef nanl
1038 #undef nearbyint
1039 #undef nearbyintf
1040 #undef nearbyintl
1041 #undef nextafter
1042 #undef nextafterf
1043 #undef nextafterl
1044 #undef nexttoward
1045 #undef nexttowardf
1046 #undef nexttowardl
1047 #undef remainder
1048 #undef remainderf
1049 #undef remainderl
1050 #undef remquo
1051 #undef remquof
1052 #undef remquol
1053 #undef rint
1054 #undef rintf
1055 #undef rintl
1056 #undef round
1057 #undef roundf
1058 #undef roundl
1059 #undef scalbln
1060 #undef scalblnf
1061 #undef scalblnl
1062 #undef scalbn
1063 #undef scalbnf
1064 #undef scalbnl
1065 #undef tgamma
1066 #undef tgammaf
1067 #undef tgammal
1068 #undef trunc
1069 #undef truncf
1070 #undef truncl
1072 namespace std _GLIBCXX_VISIBILITY(default)
1074 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1076   // types
1077   using ::double_t;
1078   using ::float_t;
1080   // functions
1081   using ::acosh;
1082   using ::acoshf;
1083   using ::acoshl;
1085   using ::asinh;
1086   using ::asinhf;
1087   using ::asinhl;
1089   using ::atanh;
1090   using ::atanhf;
1091   using ::atanhl;
1093   using ::cbrt;
1094   using ::cbrtf;
1095   using ::cbrtl;
1097   using ::copysign;
1098   using ::copysignf;
1099   using ::copysignl;
1101   using ::erf;
1102   using ::erff;
1103   using ::erfl;
1105   using ::erfc;
1106   using ::erfcf;
1107   using ::erfcl;
1109   using ::exp2;
1110   using ::exp2f;
1111   using ::exp2l;
1113   using ::expm1;
1114   using ::expm1f;
1115   using ::expm1l;
1117   using ::fdim;
1118   using ::fdimf;
1119   using ::fdiml;
1121   using ::fma;
1122   using ::fmaf;
1123   using ::fmal;
1125   using ::fmax;
1126   using ::fmaxf;
1127   using ::fmaxl;
1129   using ::fmin;
1130   using ::fminf;
1131   using ::fminl;
1133   using ::hypot;
1134   using ::hypotf;
1135   using ::hypotl;
1137   using ::ilogb;
1138   using ::ilogbf;
1139   using ::ilogbl;
1141   using ::lgamma;
1142   using ::lgammaf;
1143   using ::lgammal;
1145   using ::llrint;
1146   using ::llrintf;
1147   using ::llrintl;
1149   using ::llround;
1150   using ::llroundf;
1151   using ::llroundl;
1153   using ::log1p;
1154   using ::log1pf;
1155   using ::log1pl;
1157   using ::log2;
1158   using ::log2f;
1159   using ::log2l;
1161   using ::logb;
1162   using ::logbf;
1163   using ::logbl;
1165   using ::lrint;
1166   using ::lrintf;
1167   using ::lrintl;
1169   using ::lround;
1170   using ::lroundf;
1171   using ::lroundl;
1173   using ::nan;
1174   using ::nanf;
1175   using ::nanl;
1177   using ::nearbyint;
1178   using ::nearbyintf;
1179   using ::nearbyintl;
1181   using ::nextafter;
1182   using ::nextafterf;
1183   using ::nextafterl;
1185   using ::nexttoward;
1186   using ::nexttowardf;
1187   using ::nexttowardl;
1189   using ::remainder;
1190   using ::remainderf;
1191   using ::remainderl;
1193   using ::remquo;
1194   using ::remquof;
1195   using ::remquol;
1197   using ::rint;
1198   using ::rintf;
1199   using ::rintl;
1201   using ::round;
1202   using ::roundf;
1203   using ::roundl;
1205   using ::scalbln;
1206   using ::scalblnf;
1207   using ::scalblnl;
1209   using ::scalbn;
1210   using ::scalbnf;
1211   using ::scalbnl;
1213   using ::tgamma;
1214   using ::tgammaf;
1215   using ::tgammal;
1217   using ::trunc;
1218   using ::truncf;
1219   using ::truncl;
1221   /// Additional overloads.
1222 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1223   constexpr float
1224   acosh(float __x)
1225   { return __builtin_acoshf(__x); }
1227   constexpr long double
1228   acosh(long double __x)
1229   { return __builtin_acoshl(__x); }
1230 #endif
1232   template<typename _Tp>
1233     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1234                                               double>::__type
1235     acosh(_Tp __x)
1236     { return __builtin_acosh(__x); }
1238 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1239   constexpr float
1240   asinh(float __x)
1241   { return __builtin_asinhf(__x); }
1243   constexpr long double
1244   asinh(long double __x)
1245   { return __builtin_asinhl(__x); }
1246 #endif
1248   template<typename _Tp>
1249     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1250                                               double>::__type
1251     asinh(_Tp __x)
1252     { return __builtin_asinh(__x); }
1254 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1255   constexpr float
1256   atanh(float __x)
1257   { return __builtin_atanhf(__x); }
1259   constexpr long double
1260   atanh(long double __x)
1261   { return __builtin_atanhl(__x); }
1262 #endif
1264   template<typename _Tp>
1265     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1266                                               double>::__type
1267     atanh(_Tp __x)
1268     { return __builtin_atanh(__x); }
1270 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1271   constexpr float
1272   cbrt(float __x)
1273   { return __builtin_cbrtf(__x); }
1275   constexpr long double
1276   cbrt(long double __x)
1277   { return __builtin_cbrtl(__x); }
1278 #endif
1280   template<typename _Tp>
1281     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1282                                               double>::__type
1283     cbrt(_Tp __x)
1284     { return __builtin_cbrt(__x); }
1286 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1287   constexpr float
1288   copysign(float __x, float __y)
1289   { return __builtin_copysignf(__x, __y); }
1291   constexpr long double
1292   copysign(long double __x, long double __y)
1293   { return __builtin_copysignl(__x, __y); }
1294 #endif
1296   template<typename _Tp, typename _Up>
1297     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1298     copysign(_Tp __x, _Up __y)
1299     {
1300       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1301       return copysign(__type(__x), __type(__y));
1302     }
1304 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1305   constexpr float
1306   erf(float __x)
1307   { return __builtin_erff(__x); }
1309   constexpr long double
1310   erf(long double __x)
1311   { return __builtin_erfl(__x); }
1312 #endif
1314   template<typename _Tp>
1315     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1316                                               double>::__type
1317     erf(_Tp __x)
1318     { return __builtin_erf(__x); }
1320 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1321   constexpr float
1322   erfc(float __x)
1323   { return __builtin_erfcf(__x); }
1325   constexpr long double
1326   erfc(long double __x)
1327   { return __builtin_erfcl(__x); }
1328 #endif
1330   template<typename _Tp>
1331     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1332                                               double>::__type
1333     erfc(_Tp __x)
1334     { return __builtin_erfc(__x); }
1336 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1337   constexpr float
1338   exp2(float __x)
1339   { return __builtin_exp2f(__x); }
1341   constexpr long double
1342   exp2(long double __x)
1343   { return __builtin_exp2l(__x); }
1344 #endif
1346   template<typename _Tp>
1347     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1348                                               double>::__type
1349     exp2(_Tp __x)
1350     { return __builtin_exp2(__x); }
1352 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1353   constexpr float
1354   expm1(float __x)
1355   { return __builtin_expm1f(__x); }
1357   constexpr long double
1358   expm1(long double __x)
1359   { return __builtin_expm1l(__x); }
1360 #endif
1362   template<typename _Tp>
1363     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1364                                               double>::__type
1365     expm1(_Tp __x)
1366     { return __builtin_expm1(__x); }
1368 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1369   constexpr float
1370   fdim(float __x, float __y)
1371   { return __builtin_fdimf(__x, __y); }
1373   constexpr long double
1374   fdim(long double __x, long double __y)
1375   { return __builtin_fdiml(__x, __y); }
1376 #endif
1378   template<typename _Tp, typename _Up>
1379     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1380     fdim(_Tp __x, _Up __y)
1381     {
1382       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1383       return fdim(__type(__x), __type(__y));
1384     }
1386 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1387   constexpr float
1388   fma(float __x, float __y, float __z)
1389   { return __builtin_fmaf(__x, __y, __z); }
1391   constexpr long double
1392   fma(long double __x, long double __y, long double __z)
1393   { return __builtin_fmal(__x, __y, __z); }
1394 #endif
1396   template<typename _Tp, typename _Up, typename _Vp>
1397     constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
1398     fma(_Tp __x, _Up __y, _Vp __z)
1399     {
1400       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1401       return fma(__type(__x), __type(__y), __type(__z));
1402     }
1404 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1405   constexpr float
1406   fmax(float __x, float __y)
1407   { return __builtin_fmaxf(__x, __y); }
1409   constexpr long double
1410   fmax(long double __x, long double __y)
1411   { return __builtin_fmaxl(__x, __y); }
1412 #endif
1414   template<typename _Tp, typename _Up>
1415     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1416     fmax(_Tp __x, _Up __y)
1417     {
1418       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1419       return fmax(__type(__x), __type(__y));
1420     }
1422 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1423   constexpr float
1424   fmin(float __x, float __y)
1425   { return __builtin_fminf(__x, __y); }
1427   constexpr long double
1428   fmin(long double __x, long double __y)
1429   { return __builtin_fminl(__x, __y); }
1430 #endif
1432   template<typename _Tp, typename _Up>
1433     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1434     fmin(_Tp __x, _Up __y)
1435     {
1436       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1437       return fmin(__type(__x), __type(__y));
1438     }
1440 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1441   constexpr float
1442   hypot(float __x, float __y)
1443   { return __builtin_hypotf(__x, __y); }
1445   constexpr long double
1446   hypot(long double __x, long double __y)
1447   { return __builtin_hypotl(__x, __y); }
1448 #endif
1450   template<typename _Tp, typename _Up>
1451     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1452     hypot(_Tp __x, _Up __y)
1453     {
1454       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1455       return hypot(__type(__x), __type(__y));
1456     }
1458 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1459   constexpr int
1460   ilogb(float __x)
1461   { return __builtin_ilogbf(__x); }
1463   constexpr int
1464   ilogb(long double __x)
1465   { return __builtin_ilogbl(__x); }
1466 #endif
1468   template<typename _Tp>
1469     constexpr
1470     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1471                                     int>::__type
1472     ilogb(_Tp __x)
1473     { return __builtin_ilogb(__x); }
1475 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1476   constexpr float
1477   lgamma(float __x)
1478   { return __builtin_lgammaf(__x); }
1480   constexpr long double
1481   lgamma(long double __x)
1482   { return __builtin_lgammal(__x); }
1483 #endif
1485   template<typename _Tp>
1486     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1487                                               double>::__type
1488     lgamma(_Tp __x)
1489     { return __builtin_lgamma(__x); }
1491 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1492   constexpr long long
1493   llrint(float __x)
1494   { return __builtin_llrintf(__x); }
1496   constexpr long long
1497   llrint(long double __x)
1498   { return __builtin_llrintl(__x); }
1499 #endif
1501   template<typename _Tp>
1502     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1503                                               long long>::__type
1504     llrint(_Tp __x)
1505     { return __builtin_llrint(__x); }
1507 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1508   constexpr long long
1509   llround(float __x)
1510   { return __builtin_llroundf(__x); }
1512   constexpr long long
1513   llround(long double __x)
1514   { return __builtin_llroundl(__x); }
1515 #endif
1517   template<typename _Tp>
1518     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1519                                               long long>::__type
1520     llround(_Tp __x)
1521     { return __builtin_llround(__x); }
1523 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1524   constexpr float
1525   log1p(float __x)
1526   { return __builtin_log1pf(__x); }
1528   constexpr long double
1529   log1p(long double __x)
1530   { return __builtin_log1pl(__x); }
1531 #endif
1533   template<typename _Tp>
1534     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1535                                               double>::__type
1536     log1p(_Tp __x)
1537     { return __builtin_log1p(__x); }
1539 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1540   // DR 568.
1541   constexpr float
1542   log2(float __x)
1543   { return __builtin_log2f(__x); }
1545   constexpr long double
1546   log2(long double __x)
1547   { return __builtin_log2l(__x); }
1548 #endif
1550   template<typename _Tp>
1551     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1552                                               double>::__type
1553     log2(_Tp __x)
1554     { return __builtin_log2(__x); }
1556 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1557   constexpr float
1558   logb(float __x)
1559   { return __builtin_logbf(__x); }
1561   constexpr long double
1562   logb(long double __x)
1563   { return __builtin_logbl(__x); }
1564 #endif
1566   template<typename _Tp>
1567     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1568                                               double>::__type
1569     logb(_Tp __x)
1570     { return __builtin_logb(__x); }
1572 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1573   constexpr long
1574   lrint(float __x)
1575   { return __builtin_lrintf(__x); }
1577   constexpr long
1578   lrint(long double __x)
1579   { return __builtin_lrintl(__x); }
1580 #endif
1582   template<typename _Tp>
1583     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1584                                               long>::__type
1585     lrint(_Tp __x)
1586     { return __builtin_lrint(__x); }
1588 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1589   constexpr long
1590   lround(float __x)
1591   { return __builtin_lroundf(__x); }
1593   constexpr long
1594   lround(long double __x)
1595   { return __builtin_lroundl(__x); }
1596 #endif
1598   template<typename _Tp>
1599     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1600                                               long>::__type
1601     lround(_Tp __x)
1602     { return __builtin_lround(__x); }
1604 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1605   constexpr float
1606   nearbyint(float __x)
1607   { return __builtin_nearbyintf(__x); }
1609   constexpr long double
1610   nearbyint(long double __x)
1611   { return __builtin_nearbyintl(__x); }
1612 #endif
1614   template<typename _Tp>
1615     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1616                                               double>::__type
1617     nearbyint(_Tp __x)
1618     { return __builtin_nearbyint(__x); }
1620 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1621   constexpr float
1622   nextafter(float __x, float __y)
1623   { return __builtin_nextafterf(__x, __y); }
1625   constexpr long double
1626   nextafter(long double __x, long double __y)
1627   { return __builtin_nextafterl(__x, __y); }
1628 #endif
1630   template<typename _Tp, typename _Up>
1631     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1632     nextafter(_Tp __x, _Up __y)
1633     {
1634       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1635       return nextafter(__type(__x), __type(__y));
1636     }
1638 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1639   constexpr float
1640   nexttoward(float __x, long double __y)
1641   { return __builtin_nexttowardf(__x, __y); }
1643   constexpr long double
1644   nexttoward(long double __x, long double __y)
1645   { return __builtin_nexttowardl(__x, __y); }
1646 #endif
1648   template<typename _Tp>
1649     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1650                                               double>::__type
1651     nexttoward(_Tp __x, long double __y)
1652     { return __builtin_nexttoward(__x, __y); }
1654 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1655   constexpr float
1656   remainder(float __x, float __y)
1657   { return __builtin_remainderf(__x, __y); }
1659   constexpr long double
1660   remainder(long double __x, long double __y)
1661   { return __builtin_remainderl(__x, __y); }
1662 #endif
1664   template<typename _Tp, typename _Up>
1665     constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1666     remainder(_Tp __x, _Up __y)
1667     {
1668       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1669       return remainder(__type(__x), __type(__y));
1670     }
1672 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1673   inline float
1674   remquo(float __x, float __y, int* __pquo)
1675   { return __builtin_remquof(__x, __y, __pquo); }
1677   inline long double
1678   remquo(long double __x, long double __y, int* __pquo)
1679   { return __builtin_remquol(__x, __y, __pquo); }
1680 #endif
1682   template<typename _Tp, typename _Up>
1683     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1684     remquo(_Tp __x, _Up __y, int* __pquo)
1685     {
1686       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1687       return remquo(__type(__x), __type(__y), __pquo);
1688     }
1690 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1691   constexpr float
1692   rint(float __x)
1693   { return __builtin_rintf(__x); }
1695   constexpr long double
1696   rint(long double __x)
1697   { return __builtin_rintl(__x); }
1698 #endif
1700   template<typename _Tp>
1701     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1702                                               double>::__type
1703     rint(_Tp __x)
1704     { return __builtin_rint(__x); }
1706 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1707   constexpr float
1708   round(float __x)
1709   { return __builtin_roundf(__x); }
1711   constexpr long double
1712   round(long double __x)
1713   { return __builtin_roundl(__x); }
1714 #endif
1716   template<typename _Tp>
1717     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1718                                               double>::__type
1719     round(_Tp __x)
1720     { return __builtin_round(__x); }
1722 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1723   constexpr float
1724   scalbln(float __x, long __ex)
1725   { return __builtin_scalblnf(__x, __ex); }
1727   constexpr long double
1728   scalbln(long double __x, long __ex)
1729   { return __builtin_scalblnl(__x, __ex); }
1730 #endif
1732   template<typename _Tp>
1733     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1734                                               double>::__type
1735     scalbln(_Tp __x, long __ex)
1736     { return __builtin_scalbln(__x, __ex); }
1738 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1739   constexpr float
1740   scalbn(float __x, int __ex)
1741   { return __builtin_scalbnf(__x, __ex); }
1743   constexpr long double
1744   scalbn(long double __x, int __ex)
1745   { return __builtin_scalbnl(__x, __ex); }
1746 #endif
1748   template<typename _Tp>
1749     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1750                                               double>::__type
1751     scalbn(_Tp __x, int __ex)
1752     { return __builtin_scalbn(__x, __ex); }
1754 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1755   constexpr float
1756   tgamma(float __x)
1757   { return __builtin_tgammaf(__x); }
1759   constexpr long double
1760   tgamma(long double __x)
1761   { return __builtin_tgammal(__x); }
1762 #endif
1764   template<typename _Tp>
1765     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1766                                               double>::__type
1767     tgamma(_Tp __x)
1768     { return __builtin_tgamma(__x); }
1770 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
1771   constexpr float
1772   trunc(float __x)
1773   { return __builtin_truncf(__x); }
1775   constexpr long double
1776   trunc(long double __x)
1777   { return __builtin_truncl(__x); }
1778 #endif
1780   template<typename _Tp>
1781     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1782                                               double>::__type
1783     trunc(_Tp __x)
1784     { return __builtin_trunc(__x); }
1786 _GLIBCXX_END_NAMESPACE_VERSION
1787 } // namespace
1789 #endif // _GLIBCXX_USE_C99_MATH_TR1
1791 #endif // C++11
1793 #if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
1794 #  include <bits/specfun.h>
1795 #endif
1797 } // extern "C++"
1799 #endif