OSDN Git Service

Use Solaris prototypes if possible (PR libstdc++-v3/1773)
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / c_global / cmath
1 // -*- C++ -*- C forwarding header.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 // 2006, 2007, 2008, 2009, 2010, 2011
5 // Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library.  This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
12
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17
18 // Under Section 7 of GPL version 3, you are granted additional
19 // permissions described in the GCC Runtime Library Exception, version
20 // 3.1, as published by the Free Software Foundation.
21
22 // You should have received a copy of the GNU General Public License and
23 // a copy of the GCC Runtime Library Exception along with this program;
24 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
25 // <http://www.gnu.org/licenses/>.
26
27 /** @file include/cmath
28  *  This is a Standard C++ Library file.  You should @c \#include this file
29  *  in your programs, rather than any of the @a *.h implementation files.
30  *
31  *  This is the C++ version of the Standard C Library header @c math.h,
32  *  and its contents are (mostly) the same as that header, but are all
33  *  contained in the namespace @c std (except for names which are defined
34  *  as macros in C).
35  */
36
37 //
38 // ISO C++ 14882: 26.5  C library
39 //
40
41 #pragma GCC system_header
42
43 #include <bits/c++config.h>
44 #include <bits/cpp_type_traits.h>
45 #include <ext/type_traits.h>
46 #include <math.h>
47
48 #ifndef _GLIBCXX_CMATH
49 #define _GLIBCXX_CMATH 1
50
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
76
77 namespace std _GLIBCXX_VISIBILITY(default)
78 {
79 _GLIBCXX_BEGIN_NAMESPACE_VERSION
80
81 #if !defined(__CORRECT_ISO_CPP_MATH_H_PROTO1) \
82   && !defined(__CORRECT_ISO_CPP_MATH_H_PROTO2)
83   inline _GLIBCXX_CONSTEXPR double
84   abs(double __x)
85   { return __builtin_fabs(__x); }
86 #endif
87
88 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
89   inline _GLIBCXX_CONSTEXPR float
90   abs(float __x)
91   { return __builtin_fabsf(__x); }
92
93   inline _GLIBCXX_CONSTEXPR long double
94   abs(long double __x)
95   { return __builtin_fabsl(__x); }
96 #endif
97
98   template<typename _Tp>
99     inline _GLIBCXX_CONSTEXPR
100     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
101                                     double>::__type
102     abs(_Tp __x)
103     { return __builtin_fabs(__x); }
104
105   using ::acos;
106
107 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
108   inline _GLIBCXX_CONSTEXPR float
109   acos(float __x)
110   { return __builtin_acosf(__x); }
111
112   inline _GLIBCXX_CONSTEXPR long double
113   acos(long double __x)
114   { return __builtin_acosl(__x); }
115 #endif
116
117   template<typename _Tp>
118     inline _GLIBCXX_CONSTEXPR
119     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
120                                     double>::__type
121     acos(_Tp __x)
122     { return __builtin_acos(__x); }
123
124   using ::asin;
125
126 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
127   inline _GLIBCXX_CONSTEXPR float
128   asin(float __x)
129   { return __builtin_asinf(__x); }
130
131   inline _GLIBCXX_CONSTEXPR long double
132   asin(long double __x)
133   { return __builtin_asinl(__x); }
134 #endif
135
136   template<typename _Tp>
137     inline _GLIBCXX_CONSTEXPR
138     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
139                                     double>::__type
140     asin(_Tp __x)
141     { return __builtin_asin(__x); }
142
143   using ::atan;
144
145 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
146   inline _GLIBCXX_CONSTEXPR float
147   atan(float __x)
148   { return __builtin_atanf(__x); }
149
150   inline _GLIBCXX_CONSTEXPR long double
151   atan(long double __x)
152   { return __builtin_atanl(__x); }
153 #endif
154
155   template<typename _Tp>
156     inline _GLIBCXX_CONSTEXPR
157     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
158                                     double>::__type
159     atan(_Tp __x)
160     { return __builtin_atan(__x); }
161
162   using ::atan2;
163
164 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
165   inline _GLIBCXX_CONSTEXPR float
166   atan2(float __y, float __x)
167   { return __builtin_atan2f(__y, __x); }
168
169   inline _GLIBCXX_CONSTEXPR long double
170   atan2(long double __y, long double __x)
171   { return __builtin_atan2l(__y, __x); }
172 #endif
173
174   template<typename _Tp, typename _Up>
175     inline _GLIBCXX_CONSTEXPR
176     typename __gnu_cxx::__promote_2<
177     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
178                                     && __is_arithmetic<_Up>::__value,
179                                     _Tp>::__type, _Up>::__type
180     atan2(_Tp __y, _Up __x)
181     {
182       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
183       return atan2(__type(__y), __type(__x));
184     }
185
186   using ::ceil;
187
188 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
189   inline _GLIBCXX_CONSTEXPR float
190   ceil(float __x)
191   { return __builtin_ceilf(__x); }
192
193   inline _GLIBCXX_CONSTEXPR long double
194   ceil(long double __x)
195   { return __builtin_ceill(__x); }
196 #endif
197
198   template<typename _Tp>
199     inline _GLIBCXX_CONSTEXPR
200     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
201                                     double>::__type
202     ceil(_Tp __x)
203     { return __builtin_ceil(__x); }
204
205   using ::cos;
206
207 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
208   inline _GLIBCXX_CONSTEXPR float
209   cos(float __x)
210   { return __builtin_cosf(__x); }
211
212   inline _GLIBCXX_CONSTEXPR long double
213   cos(long double __x)
214   { return __builtin_cosl(__x); }
215 #endif
216
217   template<typename _Tp>
218     inline _GLIBCXX_CONSTEXPR
219     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
220                                     double>::__type
221     cos(_Tp __x)
222     { return __builtin_cos(__x); }
223
224   using ::cosh;
225
226 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
227   inline _GLIBCXX_CONSTEXPR float
228   cosh(float __x)
229   { return __builtin_coshf(__x); }
230
231   inline _GLIBCXX_CONSTEXPR long double
232   cosh(long double __x)
233   { return __builtin_coshl(__x); }
234 #endif
235
236   template<typename _Tp>
237     inline _GLIBCXX_CONSTEXPR
238     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
239                                     double>::__type
240     cosh(_Tp __x)
241     { return __builtin_cosh(__x); }
242
243   using ::exp;
244
245 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
246   inline _GLIBCXX_CONSTEXPR float
247   exp(float __x)
248   { return __builtin_expf(__x); }
249
250   inline _GLIBCXX_CONSTEXPR long double
251   exp(long double __x)
252   { return __builtin_expl(__x); }
253 #endif
254
255   template<typename _Tp>
256     inline _GLIBCXX_CONSTEXPR
257     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
258                                     double>::__type
259     exp(_Tp __x)
260     { return __builtin_exp(__x); }
261
262   using ::fabs;
263
264 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
265   inline _GLIBCXX_CONSTEXPR float
266   fabs(float __x)
267   { return __builtin_fabsf(__x); }
268
269   inline _GLIBCXX_CONSTEXPR long double
270   fabs(long double __x)
271   { return __builtin_fabsl(__x); }
272 #endif
273
274   template<typename _Tp>
275     inline _GLIBCXX_CONSTEXPR
276     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
277                                     double>::__type
278     fabs(_Tp __x)
279     { return __builtin_fabs(__x); }
280
281   using ::floor;
282
283 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
284   inline _GLIBCXX_CONSTEXPR float
285   floor(float __x)
286   { return __builtin_floorf(__x); }
287
288   inline _GLIBCXX_CONSTEXPR long double
289   floor(long double __x)
290   { return __builtin_floorl(__x); }
291 #endif
292
293   template<typename _Tp>
294     inline _GLIBCXX_CONSTEXPR
295     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
296                                     double>::__type
297     floor(_Tp __x)
298     { return __builtin_floor(__x); }
299
300   using ::fmod;
301
302 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
303   inline _GLIBCXX_CONSTEXPR float
304   fmod(float __x, float __y)
305   { return __builtin_fmodf(__x, __y); }
306
307   inline _GLIBCXX_CONSTEXPR long double
308   fmod(long double __x, long double __y)
309   { return __builtin_fmodl(__x, __y); }
310 #endif
311
312   template<typename _Tp, typename _Up>
313     inline _GLIBCXX_CONSTEXPR
314     typename __gnu_cxx::__promote_2<
315     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
316                                     && __is_arithmetic<_Up>::__value,
317                                     _Tp>::__type, _Up>::__type
318     fmod(_Tp __x, _Up __y)
319     {
320       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
321       return fmod(__type(__x), __type(__y));
322     }
323
324   using ::frexp;
325
326 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
327   inline _GLIBCXX_CONSTEXPR float
328   frexp(float __x, int* __exp)
329   { return __builtin_frexpf(__x, __exp); }
330
331   inline _GLIBCXX_CONSTEXPR long double
332   frexp(long double __x, int* __exp)
333   { return __builtin_frexpl(__x, __exp); }
334 #endif
335
336   template<typename _Tp>
337     inline _GLIBCXX_CONSTEXPR
338     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
339                                     double>::__type
340     frexp(_Tp __x, int* __exp)
341     { return __builtin_frexp(__x, __exp); }
342
343   using ::ldexp;
344
345 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
346   inline _GLIBCXX_CONSTEXPR float
347   ldexp(float __x, int __exp)
348   { return __builtin_ldexpf(__x, __exp); }
349
350   inline _GLIBCXX_CONSTEXPR long double
351   ldexp(long double __x, int __exp)
352   { return __builtin_ldexpl(__x, __exp); }
353 #endif
354
355   template<typename _Tp>
356     inline _GLIBCXX_CONSTEXPR
357     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
358                                     double>::__type
359     ldexp(_Tp __x, int __exp)
360     { return __builtin_ldexp(__x, __exp); }
361
362   using ::log;
363
364 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
365   inline _GLIBCXX_CONSTEXPR float
366   log(float __x)
367   { return __builtin_logf(__x); }
368
369   inline _GLIBCXX_CONSTEXPR long double
370   log(long double __x)
371   { return __builtin_logl(__x); }
372 #endif
373
374   template<typename _Tp>
375     inline _GLIBCXX_CONSTEXPR
376     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
377                                     double>::__type
378     log(_Tp __x)
379     { return __builtin_log(__x); }
380
381   using ::log10;
382
383 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
384   inline _GLIBCXX_CONSTEXPR float
385   log10(float __x)
386   { return __builtin_log10f(__x); }
387
388   inline _GLIBCXX_CONSTEXPR long double
389   log10(long double __x)
390   { return __builtin_log10l(__x); }
391 #endif
392
393   template<typename _Tp>
394     inline _GLIBCXX_CONSTEXPR
395     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
396                                     double>::__type
397     log10(_Tp __x)
398     { return __builtin_log10(__x); }
399
400   using ::modf;
401
402 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
403   inline _GLIBCXX_CONSTEXPR float
404   modf(float __x, float* __iptr)
405   { return __builtin_modff(__x, __iptr); }
406
407   inline _GLIBCXX_CONSTEXPR long double
408   modf(long double __x, long double* __iptr)
409   { return __builtin_modfl(__x, __iptr); }
410 #endif
411
412   using ::pow;
413
414 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
415   inline _GLIBCXX_CONSTEXPR float
416   pow(float __x, float __y)
417   { return __builtin_powf(__x, __y); }
418
419   inline _GLIBCXX_CONSTEXPR long double
420   pow(long double __x, long double __y)
421   { return __builtin_powl(__x, __y); }
422
423 #ifndef __GXX_EXPERIMENTAL_CXX0X__
424   // _GLIBCXX_RESOLVE_LIB_DEFECTS
425   // DR 550. What should the return type of pow(float,int) be?
426   inline double
427   pow(double __x, int __i)
428   { return __builtin_powi(__x, __i); }
429
430   inline float
431   pow(float __x, int __n)
432   { return __builtin_powif(__x, __n); }
433
434   inline long double
435   pow(long double __x, int __n)
436   { return __builtin_powil(__x, __n); }
437 #endif
438 #endif
439
440   template<typename _Tp, typename _Up>
441     inline _GLIBCXX_CONSTEXPR
442     typename __gnu_cxx::__promote_2<
443     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
444                                     && __is_arithmetic<_Up>::__value,
445                                     _Tp>::__type, _Up>::__type
446     pow(_Tp __x, _Up __y)
447     {
448       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
449       return pow(__type(__x), __type(__y));
450     }
451
452   using ::sin;
453
454 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
455   inline _GLIBCXX_CONSTEXPR float
456   sin(float __x)
457   { return __builtin_sinf(__x); }
458
459   inline _GLIBCXX_CONSTEXPR long double
460   sin(long double __x)
461   { return __builtin_sinl(__x); }
462 #endif
463
464   template<typename _Tp>
465     inline _GLIBCXX_CONSTEXPR
466     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
467                                     double>::__type
468     sin(_Tp __x)
469     { return __builtin_sin(__x); }
470
471   using ::sinh;
472
473 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
474   inline _GLIBCXX_CONSTEXPR float
475   sinh(float __x)
476   { return __builtin_sinhf(__x); }
477
478   inline _GLIBCXX_CONSTEXPR long double
479   sinh(long double __x)
480   { return __builtin_sinhl(__x); }
481 #endif
482
483   template<typename _Tp>
484     inline _GLIBCXX_CONSTEXPR
485     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
486                                     double>::__type
487     sinh(_Tp __x)
488     { return __builtin_sinh(__x); }
489
490   using ::sqrt;
491
492 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
493   inline _GLIBCXX_CONSTEXPR float
494   sqrt(float __x)
495   { return __builtin_sqrtf(__x); }
496
497   inline _GLIBCXX_CONSTEXPR long double
498   sqrt(long double __x)
499   { return __builtin_sqrtl(__x); }
500 #endif
501
502   template<typename _Tp>
503     inline _GLIBCXX_CONSTEXPR
504     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
505                                     double>::__type
506     sqrt(_Tp __x)
507     { return __builtin_sqrt(__x); }
508
509   using ::tan;
510
511 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
512   inline _GLIBCXX_CONSTEXPR float
513   tan(float __x)
514   { return __builtin_tanf(__x); }
515
516   inline _GLIBCXX_CONSTEXPR long double
517   tan(long double __x)
518   { return __builtin_tanl(__x); }
519 #endif
520
521   template<typename _Tp>
522     inline _GLIBCXX_CONSTEXPR
523     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
524                                     double>::__type
525     tan(_Tp __x)
526     { return __builtin_tan(__x); }
527
528   using ::tanh;
529
530 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO1
531   inline _GLIBCXX_CONSTEXPR float
532   tanh(float __x)
533   { return __builtin_tanhf(__x); }
534
535   inline _GLIBCXX_CONSTEXPR long double
536   tanh(long double __x)
537   { return __builtin_tanhl(__x); }
538 #endif
539
540   template<typename _Tp>
541     inline _GLIBCXX_CONSTEXPR
542     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
543                                     double>::__type
544     tanh(_Tp __x)
545     { return __builtin_tanh(__x); }
546
547 _GLIBCXX_END_NAMESPACE_VERSION
548 } // namespace
549
550 #if _GLIBCXX_USE_C99_MATH
551 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
552
553 // These are possible macros imported from C99-land.
554 #undef fpclassify
555 #undef isfinite
556 #undef isinf
557 #undef isnan
558 #undef isnormal
559 #undef signbit
560 #undef isgreater
561 #undef isgreaterequal
562 #undef isless
563 #undef islessequal
564 #undef islessgreater
565 #undef isunordered
566
567 namespace std _GLIBCXX_VISIBILITY(default)
568 {
569 _GLIBCXX_BEGIN_NAMESPACE_VERSION
570
571 #ifdef __GXX_EXPERIMENTAL_CXX0X__
572   constexpr int
573   fpclassify(float __x)
574   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
575                                 FP_SUBNORMAL, FP_ZERO, __x); }
576
577   constexpr int
578   fpclassify(double __x)
579   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
580                                 FP_SUBNORMAL, FP_ZERO, __x); }
581
582   constexpr int
583   fpclassify(long double __x)
584   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
585                                 FP_SUBNORMAL, FP_ZERO, __x); }
586
587   template<typename _Tp>
588     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
589                                               int>::__type
590     fpclassify(_Tp __x)
591     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
592
593   constexpr bool
594   isfinite(float __x)
595   { return __builtin_isfinite(__x); }
596
597   constexpr bool
598   isfinite(double __x)
599   { return __builtin_isfinite(__x); }
600
601   constexpr bool
602   isfinite(long double __x)
603   { return __builtin_isfinite(__x); }
604
605   template<typename _Tp>
606     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
607                                               bool>::__type
608     isfinite(_Tp __x)
609     { return true; }
610
611   constexpr bool
612   isinf(float __x)
613   { return __builtin_isinf(__x); }
614
615   constexpr bool
616   isinf(double __x)
617   { return __builtin_isinf(__x); }
618
619   constexpr bool
620   isinf(long double __x)
621   { return __builtin_isinf(__x); }
622
623   template<typename _Tp>
624     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
625                                               bool>::__type
626     isinf(_Tp __x)
627     { return false; }
628
629   constexpr bool
630   isnan(float __x)
631   { return __builtin_isnan(__x); }
632
633   constexpr bool
634   isnan(double __x)
635   { return __builtin_isnan(__x); }
636
637   constexpr bool
638   isnan(long double __x)
639   { return __builtin_isnan(__x); }
640
641   template<typename _Tp>
642     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
643                                               bool>::__type
644     isnan(_Tp __x)
645     { return false; }
646
647   constexpr bool
648   isnormal(float __x)
649   { return __builtin_isnormal(__x); }
650
651   constexpr bool
652   isnormal(double __x)
653   { return __builtin_isnormal(__x); }
654
655   constexpr bool
656   isnormal(long double __x)
657   { return __builtin_isnormal(__x); }
658
659   template<typename _Tp>
660     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
661                                               bool>::__type
662     isnormal(_Tp __x)
663     { return __x != 0 ? true : false; }
664
665   constexpr bool
666   signbit(float __x)
667   { return __builtin_signbit(__x); }
668
669   constexpr bool
670   signbit(double __x)
671   { return __builtin_signbit(__x); }
672
673   constexpr bool
674   signbit(long double __x)
675   { return __builtin_signbit(__x); }
676
677   template<typename _Tp>
678     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
679                                               bool>::__type
680     signbit(_Tp __x)
681     { return __x < 0 ? true : false; }
682
683   constexpr bool
684   isgreater(float __x, float __y)
685   { return __builtin_isgreater(__x, __y); }
686
687   constexpr bool
688   isgreater(double __x, double __y)
689   { return __builtin_isgreater(__x, __y); }
690
691   constexpr bool
692   isgreater(long double __x, long double __y)
693   { return __builtin_isgreater(__x, __y); }
694
695   template<typename _Tp, typename _Up>
696     constexpr typename
697     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
698                             && __is_arithmetic<_Up>::__value), bool>::__type
699     isgreater(_Tp __x, _Up __y)
700     {
701       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
702       return __builtin_isgreater(__type(__x), __type(__y));
703     }
704
705   constexpr bool
706   isgreaterequal(float __x, float __y)
707   { return __builtin_isgreaterequal(__x, __y); }
708
709   constexpr bool
710   isgreaterequal(double __x, double __y)
711   { return __builtin_isgreaterequal(__x, __y); }
712
713   constexpr bool
714   isgreaterequal(long double __x, long double __y)
715   { return __builtin_isgreaterequal(__x, __y); }
716
717   template<typename _Tp, typename _Up>
718     constexpr typename
719     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
720                             && __is_arithmetic<_Up>::__value), bool>::__type
721     isgreaterequal(_Tp __x, _Up __y)
722     {
723       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
724       return __builtin_isgreaterequal(__type(__x), __type(__y));
725     }
726
727   constexpr bool
728   isless(float __x, float __y)
729   { return __builtin_isless(__x, __y); }
730
731   constexpr bool
732   isless(double __x, double __y)
733   { return __builtin_isless(__x, __y); }
734
735   constexpr bool
736   isless(long double __x, long double __y)
737   { return __builtin_isless(__x, __y); }
738
739   template<typename _Tp, typename _Up>
740     constexpr typename
741     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
742                             && __is_arithmetic<_Up>::__value), bool>::__type
743     isless(_Tp __x, _Up __y)
744     {
745       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
746       return __builtin_isless(__type(__x), __type(__y));
747     }
748
749   constexpr bool
750   islessequal(float __x, float __y)
751   { return __builtin_islessequal(__x, __y); }
752
753   constexpr bool
754   islessequal(double __x, double __y)
755   { return __builtin_islessequal(__x, __y); }
756
757   constexpr bool
758   islessequal(long double __x, long double __y)
759   { return __builtin_islessequal(__x, __y); }
760
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     islessequal(_Tp __x, _Up __y)
766     {
767       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
768       return __builtin_islessequal(__type(__x), __type(__y));
769     }
770
771   constexpr bool
772   islessgreater(float __x, float __y)
773   { return __builtin_islessgreater(__x, __y); }
774
775   constexpr bool
776   islessgreater(double __x, double __y)
777   { return __builtin_islessgreater(__x, __y); }
778
779   constexpr bool
780   islessgreater(long double __x, long double __y)
781   { return __builtin_islessgreater(__x, __y); }
782
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     islessgreater(_Tp __x, _Up __y)
788     {
789       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
790       return __builtin_islessgreater(__type(__x), __type(__y));
791     }
792
793   constexpr bool
794   isunordered(float __x, float __y)
795   { return __builtin_isunordered(__x, __y); }
796
797   constexpr bool
798   isunordered(double __x, double __y)
799   { return __builtin_isunordered(__x, __y); }
800
801   constexpr bool
802   isunordered(long double __x, long double __y)
803   { return __builtin_isunordered(__x, __y); }
804
805   template<typename _Tp, typename _Up>
806     constexpr typename
807     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
808                             && __is_arithmetic<_Up>::__value), bool>::__type
809     isunordered(_Tp __x, _Up __y)
810     {
811       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
812       return __builtin_isunordered(__type(__x), __type(__y));
813     }
814
815 #else
816
817   template<typename _Tp>
818     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
819                                            int>::__type
820     fpclassify(_Tp __f)
821     {
822       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
823       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
824                                   FP_SUBNORMAL, FP_ZERO, __type(__f));
825     }
826
827   template<typename _Tp>
828     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
829                                            int>::__type
830     isfinite(_Tp __f)
831     {
832       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
833       return __builtin_isfinite(__type(__f));
834     }
835
836   template<typename _Tp>
837     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
838                                            int>::__type
839     isinf(_Tp __f)
840     {
841       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
842       return __builtin_isinf(__type(__f));
843     }
844
845   template<typename _Tp>
846     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
847                                            int>::__type
848     isnan(_Tp __f)
849     {
850       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
851       return __builtin_isnan(__type(__f));
852     }
853
854   template<typename _Tp>
855     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
856                                            int>::__type
857     isnormal(_Tp __f)
858     {
859       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
860       return __builtin_isnormal(__type(__f));
861     }
862
863   template<typename _Tp>
864     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
865                                            int>::__type
866     signbit(_Tp __f)
867     {
868       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
869       return __builtin_signbit(__type(__f));
870     }
871
872   template<typename _Tp>
873     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
874                                            int>::__type
875     isgreater(_Tp __f1, _Tp __f2)
876     {
877       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
878       return __builtin_isgreater(__type(__f1), __type(__f2));
879     }
880
881   template<typename _Tp>
882     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
883                                            int>::__type
884     isgreaterequal(_Tp __f1, _Tp __f2)
885     {
886       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
887       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
888     }
889
890   template<typename _Tp>
891     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
892                                            int>::__type
893     isless(_Tp __f1, _Tp __f2)
894     {
895       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
896       return __builtin_isless(__type(__f1), __type(__f2));
897     }
898
899   template<typename _Tp>
900     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
901                                            int>::__type
902     islessequal(_Tp __f1, _Tp __f2)
903     {
904       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
905       return __builtin_islessequal(__type(__f1), __type(__f2));
906     }
907
908   template<typename _Tp>
909     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
910                                            int>::__type
911     islessgreater(_Tp __f1, _Tp __f2)
912     {
913       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
914       return __builtin_islessgreater(__type(__f1), __type(__f2));
915     }
916
917   template<typename _Tp>
918     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
919                                            int>::__type
920     isunordered(_Tp __f1, _Tp __f2)
921     {
922       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
923       return __builtin_isunordered(__type(__f1), __type(__f2));
924     }
925
926 #endif
927
928 _GLIBCXX_END_NAMESPACE_VERSION
929 } // namespace
930
931 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
932 #endif
933
934 #ifdef __GXX_EXPERIMENTAL_CXX0X__
935
936 #ifdef _GLIBCXX_USE_C99_MATH_TR1
937
938 #undef acosh
939 #undef acoshf
940 #undef acoshl
941 #undef asinh
942 #undef asinhf
943 #undef asinhl
944 #undef atanh
945 #undef atanhf
946 #undef atanhl
947 #undef cbrt
948 #undef cbrtf
949 #undef cbrtl
950 #undef copysign
951 #undef copysignf
952 #undef copysignl
953 #undef erf
954 #undef erff
955 #undef erfl
956 #undef erfc
957 #undef erfcf
958 #undef erfcl
959 #undef exp2
960 #undef exp2f
961 #undef exp2l
962 #undef expm1
963 #undef expm1f
964 #undef expm1l
965 #undef fdim
966 #undef fdimf
967 #undef fdiml
968 #undef fma
969 #undef fmaf
970 #undef fmal
971 #undef fmax
972 #undef fmaxf
973 #undef fmaxl
974 #undef fmin
975 #undef fminf
976 #undef fminl
977 #undef hypot
978 #undef hypotf
979 #undef hypotl
980 #undef ilogb
981 #undef ilogbf
982 #undef ilogbl
983 #undef lgamma
984 #undef lgammaf
985 #undef lgammal
986 #undef llrint
987 #undef llrintf
988 #undef llrintl
989 #undef llround
990 #undef llroundf
991 #undef llroundl
992 #undef log1p
993 #undef log1pf
994 #undef log1pl
995 #undef log2
996 #undef log2f
997 #undef log2l
998 #undef logb
999 #undef logbf
1000 #undef logbl
1001 #undef lrint
1002 #undef lrintf
1003 #undef lrintl
1004 #undef lround
1005 #undef lroundf
1006 #undef lroundl
1007 #undef nan
1008 #undef nanf
1009 #undef nanl
1010 #undef nearbyint
1011 #undef nearbyintf
1012 #undef nearbyintl
1013 #undef nextafter
1014 #undef nextafterf
1015 #undef nextafterl
1016 #undef nexttoward
1017 #undef nexttowardf
1018 #undef nexttowardl
1019 #undef remainder
1020 #undef remainderf
1021 #undef remainderl
1022 #undef remquo
1023 #undef remquof
1024 #undef remquol
1025 #undef rint
1026 #undef rintf
1027 #undef rintl
1028 #undef round
1029 #undef roundf
1030 #undef roundl
1031 #undef scalbln
1032 #undef scalblnf
1033 #undef scalblnl
1034 #undef scalbn
1035 #undef scalbnf
1036 #undef scalbnl
1037 #undef tgamma
1038 #undef tgammaf
1039 #undef tgammal
1040 #undef trunc
1041 #undef truncf
1042 #undef truncl
1043
1044 namespace std _GLIBCXX_VISIBILITY(default)
1045 {
1046 _GLIBCXX_BEGIN_NAMESPACE_VERSION
1047
1048   // types
1049   using ::double_t;
1050   using ::float_t;
1051
1052   // functions
1053   using ::acosh;
1054   using ::acoshf;
1055   using ::acoshl;
1056
1057   using ::asinh;
1058   using ::asinhf;
1059   using ::asinhl;
1060
1061   using ::atanh;
1062   using ::atanhf;
1063   using ::atanhl;
1064
1065   using ::cbrt;
1066   using ::cbrtf;
1067   using ::cbrtl;
1068
1069   using ::copysign;
1070   using ::copysignf;
1071   using ::copysignl;
1072
1073   using ::erf;
1074   using ::erff;
1075   using ::erfl;
1076
1077   using ::erfc;
1078   using ::erfcf;
1079   using ::erfcl;
1080
1081   using ::exp2;
1082   using ::exp2f;
1083   using ::exp2l;
1084
1085   using ::expm1;
1086   using ::expm1f;
1087   using ::expm1l;
1088
1089   using ::fdim;
1090   using ::fdimf;
1091   using ::fdiml;
1092
1093   using ::fma;
1094   using ::fmaf;
1095   using ::fmal;
1096
1097   using ::fmax;
1098   using ::fmaxf;
1099   using ::fmaxl;
1100
1101   using ::fmin;
1102   using ::fminf;
1103   using ::fminl;
1104
1105   using ::hypot;
1106   using ::hypotf;
1107   using ::hypotl;
1108
1109   using ::ilogb;
1110   using ::ilogbf;
1111   using ::ilogbl;
1112
1113   using ::lgamma;
1114   using ::lgammaf;
1115   using ::lgammal;
1116
1117   using ::llrint;
1118   using ::llrintf;
1119   using ::llrintl;
1120
1121   using ::llround;
1122   using ::llroundf;
1123   using ::llroundl;
1124
1125   using ::log1p;
1126   using ::log1pf;
1127   using ::log1pl;
1128
1129   using ::log2;
1130   using ::log2f;
1131   using ::log2l;
1132
1133   using ::logb;
1134   using ::logbf;
1135   using ::logbl;
1136
1137   using ::lrint;
1138   using ::lrintf;
1139   using ::lrintl;
1140
1141   using ::lround;
1142   using ::lroundf;
1143   using ::lroundl;
1144
1145   using ::nan;
1146   using ::nanf;
1147   using ::nanl;
1148
1149   using ::nearbyint;
1150   using ::nearbyintf;
1151   using ::nearbyintl;
1152
1153   using ::nextafter;
1154   using ::nextafterf;
1155   using ::nextafterl;
1156
1157   using ::nexttoward;
1158   using ::nexttowardf;
1159   using ::nexttowardl;
1160
1161   using ::remainder;
1162   using ::remainderf;
1163   using ::remainderl;
1164
1165   using ::remquo;
1166   using ::remquof;
1167   using ::remquol;
1168
1169   using ::rint;
1170   using ::rintf;
1171   using ::rintl;
1172
1173   using ::round;
1174   using ::roundf;
1175   using ::roundl;
1176
1177   using ::scalbln;
1178   using ::scalblnf;
1179   using ::scalblnl;
1180
1181   using ::scalbn;
1182   using ::scalbnf;
1183   using ::scalbnl;
1184
1185   using ::tgamma;
1186   using ::tgammaf;
1187   using ::tgammal;
1188
1189   using ::trunc;
1190   using ::truncf;
1191   using ::truncl;
1192
1193   /// Additional overloads.
1194   constexpr float
1195   acosh(float __x)
1196   { return __builtin_acoshf(__x); }
1197
1198   constexpr long double
1199   acosh(long double __x)
1200   { return __builtin_acoshl(__x); }
1201
1202   template<typename _Tp>
1203     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1204                                               double>::__type
1205     acosh(_Tp __x)
1206     { return __builtin_acosh(__x); }
1207
1208   constexpr float
1209   asinh(float __x)
1210   { return __builtin_asinhf(__x); }
1211
1212   constexpr long double
1213   asinh(long double __x)
1214   { return __builtin_asinhl(__x); }
1215
1216   template<typename _Tp>
1217     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1218                                               double>::__type
1219     asinh(_Tp __x)
1220     { return __builtin_asinh(__x); }
1221
1222   constexpr float
1223   atanh(float __x)
1224   { return __builtin_atanhf(__x); }
1225
1226   constexpr long double
1227   atanh(long double __x)
1228   { return __builtin_atanhl(__x); }
1229
1230   template<typename _Tp>
1231     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1232                                               double>::__type
1233     atanh(_Tp __x)
1234     { return __builtin_atanh(__x); }
1235
1236   constexpr float
1237   cbrt(float __x)
1238   { return __builtin_cbrtf(__x); }
1239
1240   constexpr long double
1241   cbrt(long double __x)
1242   { return __builtin_cbrtl(__x); }
1243
1244   template<typename _Tp>
1245     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1246                                               double>::__type
1247     cbrt(_Tp __x)
1248     { return __builtin_cbrt(__x); }
1249
1250   constexpr float
1251   copysign(float __x, float __y)
1252   { return __builtin_copysignf(__x, __y); }
1253
1254   constexpr long double
1255   copysign(long double __x, long double __y)
1256   { return __builtin_copysignl(__x, __y); }
1257
1258   template<typename _Tp, typename _Up>
1259     constexpr
1260     typename __gnu_cxx::__promote_2<
1261     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1262                                     && __is_arithmetic<_Up>::__value,
1263                                     _Tp>::__type, _Up>::__type
1264     copysign(_Tp __x, _Up __y)
1265     {
1266       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1267       return copysign(__type(__x), __type(__y));
1268     }
1269
1270   constexpr float
1271   erf(float __x)
1272   { return __builtin_erff(__x); }
1273
1274   constexpr long double
1275   erf(long double __x)
1276   { return __builtin_erfl(__x); }
1277
1278   template<typename _Tp>
1279     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1280                                               double>::__type
1281     erf(_Tp __x)
1282     { return __builtin_erf(__x); }
1283
1284   constexpr float
1285   erfc(float __x)
1286   { return __builtin_erfcf(__x); }
1287
1288   constexpr long double
1289   erfc(long double __x)
1290   { return __builtin_erfcl(__x); }
1291
1292   template<typename _Tp>
1293     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1294                                               double>::__type
1295     erfc(_Tp __x)
1296     { return __builtin_erfc(__x); }
1297
1298   constexpr float
1299   exp2(float __x)
1300   { return __builtin_exp2f(__x); }
1301
1302   constexpr long double
1303   exp2(long double __x)
1304   { return __builtin_exp2l(__x); }
1305
1306   template<typename _Tp>
1307     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1308                                               double>::__type
1309     exp2(_Tp __x)
1310     { return __builtin_exp2(__x); }
1311
1312   constexpr float
1313   expm1(float __x)
1314   { return __builtin_expm1f(__x); }
1315
1316   constexpr long double
1317   expm1(long double __x)
1318   { return __builtin_expm1l(__x); }
1319
1320   template<typename _Tp>
1321     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1322                                               double>::__type
1323     expm1(_Tp __x)
1324     { return __builtin_expm1(__x); }
1325
1326   constexpr float
1327   fdim(float __x, float __y)
1328   { return __builtin_fdimf(__x, __y); }
1329
1330   constexpr long double
1331   fdim(long double __x, long double __y)
1332   { return __builtin_fdiml(__x, __y); }
1333
1334   template<typename _Tp, typename _Up>
1335     constexpr
1336     typename __gnu_cxx::__promote_2<
1337     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1338                                     && __is_arithmetic<_Up>::__value,
1339                                     _Tp>::__type, _Up>::__type
1340     fdim(_Tp __x, _Up __y)
1341     {
1342       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1343       return fdim(__type(__x), __type(__y));
1344     }
1345
1346   constexpr float
1347   fma(float __x, float __y, float __z)
1348   { return __builtin_fmaf(__x, __y, __z); }
1349
1350   constexpr long double
1351   fma(long double __x, long double __y, long double __z)
1352   { return __builtin_fmal(__x, __y, __z); }
1353
1354   template<typename _Tp, typename _Up, typename _Vp>
1355     constexpr
1356     typename __gnu_cxx::__promote_3<
1357     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1358                                     && __is_arithmetic<_Up>::__value
1359                                     && __is_arithmetic<_Vp>::__value,
1360                                     _Tp>::__type, _Up, _Vp>::__type
1361     fma(_Tp __x, _Up __y, _Vp __z)
1362     {
1363       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1364       return fma(__type(__x), __type(__y), __type(__z));
1365     }
1366
1367   constexpr float
1368   fmax(float __x, float __y)
1369   { return __builtin_fmaxf(__x, __y); }
1370
1371   constexpr long double
1372   fmax(long double __x, long double __y)
1373   { return __builtin_fmaxl(__x, __y); }
1374
1375   template<typename _Tp, typename _Up>
1376     constexpr
1377     typename __gnu_cxx::__promote_2<
1378     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1379                                     && __is_arithmetic<_Up>::__value,
1380                                     _Tp>::__type, _Up>::__type
1381     fmax(_Tp __x, _Up __y)
1382     {
1383       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1384       return fmax(__type(__x), __type(__y));
1385     }
1386
1387   constexpr float
1388   fmin(float __x, float __y)
1389   { return __builtin_fminf(__x, __y); }
1390
1391   constexpr long double
1392   fmin(long double __x, long double __y)
1393   { return __builtin_fminl(__x, __y); }
1394
1395   template<typename _Tp, typename _Up>
1396     constexpr
1397     typename __gnu_cxx::__promote_2<
1398     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1399                                     && __is_arithmetic<_Up>::__value,
1400                                     _Tp>::__type, _Up>::__type
1401     fmin(_Tp __x, _Up __y)
1402     {
1403       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1404       return fmin(__type(__x), __type(__y));
1405     }
1406
1407   constexpr float
1408   hypot(float __x, float __y)
1409   { return __builtin_hypotf(__x, __y); }
1410
1411   constexpr long double
1412   hypot(long double __x, long double __y)
1413   { return __builtin_hypotl(__x, __y); }
1414
1415   template<typename _Tp, typename _Up>
1416     constexpr
1417     typename __gnu_cxx::__promote_2<
1418     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1419                                     && __is_arithmetic<_Up>::__value,
1420                                     _Tp>::__type, _Up>::__type
1421      hypot(_Tp __x, _Up __y)
1422     {
1423       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1424       return hypot(__type(__x), __type(__y));
1425     }
1426
1427   constexpr int
1428   ilogb(float __x)
1429   { return __builtin_ilogbf(__x); }
1430
1431   constexpr int
1432   ilogb(long double __x)
1433   { return __builtin_ilogbl(__x); }
1434
1435   template<typename _Tp>
1436     constexpr
1437     typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1438                                     int>::__type
1439     ilogb(_Tp __x)
1440     { return __builtin_ilogb(__x); }
1441
1442   constexpr float
1443   lgamma(float __x)
1444   { return __builtin_lgammaf(__x); }
1445
1446   constexpr long double
1447   lgamma(long double __x)
1448   { return __builtin_lgammal(__x); }
1449
1450   template<typename _Tp>
1451     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1452                                               double>::__type
1453     lgamma(_Tp __x)
1454     { return __builtin_lgamma(__x); }
1455
1456   constexpr long long
1457   llrint(float __x)
1458   { return __builtin_llrintf(__x); }
1459
1460   constexpr long long
1461   llrint(long double __x)
1462   { return __builtin_llrintl(__x); }
1463
1464   template<typename _Tp>
1465     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1466                                               long long>::__type
1467     llrint(_Tp __x)
1468     { return __builtin_llrint(__x); }
1469
1470   constexpr long long
1471   llround(float __x)
1472   { return __builtin_llroundf(__x); }
1473
1474   constexpr long long
1475   llround(long double __x)
1476   { return __builtin_llroundl(__x); }
1477
1478   template<typename _Tp>
1479     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1480                                               long long>::__type
1481     llround(_Tp __x)
1482     { return __builtin_llround(__x); }
1483
1484   constexpr float
1485   log1p(float __x)
1486   { return __builtin_log1pf(__x); }
1487
1488   constexpr long double
1489   log1p(long double __x)
1490   { return __builtin_log1pl(__x); }
1491
1492   template<typename _Tp>
1493     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1494                                               double>::__type
1495     log1p(_Tp __x)
1496     { return __builtin_log1p(__x); }
1497
1498   // DR 568.
1499   constexpr float
1500   log2(float __x)
1501   { return __builtin_log2f(__x); }
1502
1503   constexpr long double
1504   log2(long double __x)
1505   { return __builtin_log2l(__x); }
1506
1507   template<typename _Tp>
1508     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1509                                               double>::__type
1510     log2(_Tp __x)
1511     { return __builtin_log2(__x); }
1512
1513   constexpr float
1514   logb(float __x)
1515   { return __builtin_logbf(__x); }
1516
1517   constexpr long double
1518   logb(long double __x)
1519   { return __builtin_logbl(__x); }
1520
1521   template<typename _Tp>
1522     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1523                                               double>::__type
1524     logb(_Tp __x)
1525     { return __builtin_logb(__x); }
1526
1527   constexpr long
1528   lrint(float __x)
1529   { return __builtin_lrintf(__x); }
1530
1531   constexpr long
1532   lrint(long double __x)
1533   { return __builtin_lrintl(__x); }
1534
1535   template<typename _Tp>
1536     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1537                                               long>::__type
1538     lrint(_Tp __x)
1539     { return __builtin_lrint(__x); }
1540
1541   constexpr long
1542   lround(float __x)
1543   { return __builtin_lroundf(__x); }
1544
1545   constexpr long
1546   lround(long double __x)
1547   { return __builtin_lroundl(__x); }
1548
1549   template<typename _Tp>
1550     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1551                                               long>::__type
1552     lround(_Tp __x)
1553     { return __builtin_lround(__x); }
1554
1555   constexpr float
1556   nearbyint(float __x)
1557   { return __builtin_nearbyintf(__x); }
1558
1559   constexpr long double
1560   nearbyint(long double __x)
1561   { return __builtin_nearbyintl(__x); }
1562
1563   template<typename _Tp>
1564     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1565                                               double>::__type
1566     nearbyint(_Tp __x)
1567     { return __builtin_nearbyint(__x); }
1568
1569   constexpr float
1570   nextafter(float __x, float __y)
1571   { return __builtin_nextafterf(__x, __y); }
1572
1573   constexpr long double
1574   nextafter(long double __x, long double __y)
1575   { return __builtin_nextafterl(__x, __y); }
1576
1577   template<typename _Tp, typename _Up>
1578     constexpr
1579     typename __gnu_cxx::__promote_2<
1580     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1581                                     && __is_arithmetic<_Up>::__value,
1582                                     _Tp>::__type, _Up>::__type
1583     nextafter(_Tp __x, _Up __y)
1584     {
1585       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1586       return nextafter(__type(__x), __type(__y));
1587     }
1588
1589   constexpr float
1590   nexttoward(float __x, long double __y)
1591   { return __builtin_nexttowardf(__x, __y); }
1592
1593   constexpr long double
1594   nexttoward(long double __x, long double __y)
1595   { return __builtin_nexttowardl(__x, __y); }
1596
1597   template<typename _Tp>
1598     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1599                                               double>::__type
1600     nexttoward(_Tp __x, long double __y)
1601     { return __builtin_nexttoward(__x, __y); }
1602
1603   constexpr float
1604   remainder(float __x, float __y)
1605   { return __builtin_remainderf(__x, __y); }
1606
1607   constexpr long double
1608   remainder(long double __x, long double __y)
1609   { return __builtin_remainderl(__x, __y); }
1610
1611   template<typename _Tp, typename _Up>
1612     constexpr
1613     typename __gnu_cxx::__promote_2<
1614     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1615                                     && __is_arithmetic<_Up>::__value,
1616                                     _Tp>::__type, _Up>::__type
1617     remainder(_Tp __x, _Up __y)
1618     {
1619       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1620       return remainder(__type(__x), __type(__y));
1621     }
1622
1623   constexpr float
1624   remquo(float __x, float __y, int* __pquo)
1625   { return __builtin_remquof(__x, __y, __pquo); }
1626
1627   constexpr long double
1628   remquo(long double __x, long double __y, int* __pquo)
1629   { return __builtin_remquol(__x, __y, __pquo); }
1630
1631   template<typename _Tp, typename _Up>
1632     constexpr
1633     typename __gnu_cxx::__promote_2<
1634     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
1635                                     && __is_arithmetic<_Up>::__value,
1636                                     _Tp>::__type, _Up>::__type
1637     remquo(_Tp __x, _Up __y, int* __pquo)
1638     {
1639       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1640       return remquo(__type(__x), __type(__y), __pquo);
1641     }
1642
1643   constexpr float
1644   rint(float __x)
1645   { return __builtin_rintf(__x); }
1646
1647   constexpr long double
1648   rint(long double __x)
1649   { return __builtin_rintl(__x); }
1650
1651   template<typename _Tp>
1652     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1653                                               double>::__type
1654     rint(_Tp __x)
1655     { return __builtin_rint(__x); }
1656
1657   constexpr float
1658   round(float __x)
1659   { return __builtin_roundf(__x); }
1660
1661   constexpr long double
1662   round(long double __x)
1663   { return __builtin_roundl(__x); }
1664
1665   template<typename _Tp>
1666     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1667                                               double>::__type
1668     round(_Tp __x)
1669     { return __builtin_round(__x); }
1670
1671   constexpr float
1672   scalbln(float __x, long __ex)
1673   { return __builtin_scalblnf(__x, __ex); }
1674
1675   constexpr long double
1676   scalbln(long double __x, long __ex)
1677   { return __builtin_scalblnl(__x, __ex); }
1678
1679   template<typename _Tp>
1680     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1681                                               double>::__type
1682     scalbln(_Tp __x, long __ex)
1683     { return __builtin_scalbln(__x, __ex); }
1684  
1685   constexpr float
1686   scalbn(float __x, int __ex)
1687   { return __builtin_scalbnf(__x, __ex); }
1688
1689   constexpr long double
1690   scalbn(long double __x, int __ex)
1691   { return __builtin_scalbnl(__x, __ex); }
1692
1693   template<typename _Tp>
1694     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1695                                               double>::__type
1696     scalbn(_Tp __x, int __ex)
1697     { return __builtin_scalbn(__x, __ex); }
1698
1699   constexpr float
1700   tgamma(float __x)
1701   { return __builtin_tgammaf(__x); }
1702
1703   constexpr long double
1704   tgamma(long double __x)
1705   { return __builtin_tgammal(__x); }
1706
1707   template<typename _Tp>
1708     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1709                                               double>::__type
1710     tgamma(_Tp __x)
1711     { return __builtin_tgamma(__x); }
1712  
1713   constexpr float
1714   trunc(float __x)
1715   { return __builtin_truncf(__x); }
1716
1717   constexpr long double
1718   trunc(long double __x)
1719   { return __builtin_truncl(__x); }
1720
1721   template<typename _Tp>
1722     constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
1723                                               double>::__type
1724     trunc(_Tp __x)
1725     { return __builtin_trunc(__x); }
1726
1727 _GLIBCXX_END_NAMESPACE_VERSION
1728 } // namespace
1729
1730 #endif // _GLIBCXX_USE_C99_MATH_TR1
1731
1732 #endif // __GXX_EXPERIMENTAL_CXX0X__
1733
1734 #endif