OSDN Git Service

2010-08-08 Paolo Carlini <paolo.carlini@oracle.com>
[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
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 _GLIBCXX_BEGIN_NAMESPACE(std)
78
79   // Forward declaration of a helper function.  This really should be
80   // an `exported' forward declaration.
81   template<typename _Tp>
82     _Tp __cmath_power(_Tp, unsigned int);
83
84   template<typename _Tp>
85     inline _Tp
86     __pow_helper(_Tp __x, int __n)
87     {
88       return __n < 0
89         ? _Tp(1)/__cmath_power(__x, -__n)
90         : __cmath_power(__x, __n);
91     }
92
93   inline double
94   abs(double __x)
95   { return __builtin_fabs(__x); }
96
97   inline float
98   abs(float __x)
99   { return __builtin_fabsf(__x); }
100
101   inline long double
102   abs(long double __x)
103   { return __builtin_fabsl(__x); }
104
105   template<typename _Tp>
106     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
107                                            double>::__type
108     abs(_Tp __x)
109     { return __builtin_fabs(__x); }
110
111   using ::acos;
112
113   inline float
114   acos(float __x)
115   { return __builtin_acosf(__x); }
116
117   inline long double
118   acos(long double __x)
119   { return __builtin_acosl(__x); }
120
121   template<typename _Tp>
122     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
123                                            double>::__type
124     acos(_Tp __x)
125     { return __builtin_acos(__x); }
126
127   using ::asin;
128
129   inline float
130   asin(float __x)
131   { return __builtin_asinf(__x); }
132
133   inline long double
134   asin(long double __x)
135   { return __builtin_asinl(__x); }
136
137   template<typename _Tp>
138     inline 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   inline float
146   atan(float __x)
147   { return __builtin_atanf(__x); }
148
149   inline long double
150   atan(long double __x)
151   { return __builtin_atanl(__x); }
152
153   template<typename _Tp>
154     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
155                                            double>::__type
156     atan(_Tp __x)
157     { return __builtin_atan(__x); }
158
159   using ::atan2;
160
161   inline float
162   atan2(float __y, float __x)
163   { return __builtin_atan2f(__y, __x); }
164
165   inline long double
166   atan2(long double __y, long double __x)
167   { return __builtin_atan2l(__y, __x); }
168
169   template<typename _Tp, typename _Up>
170     inline
171     typename __gnu_cxx::__promote_2<
172     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
173                                     && __is_arithmetic<_Up>::__value,
174                                     _Tp>::__type, _Up>::__type
175     atan2(_Tp __y, _Up __x)
176     {
177       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
178       return atan2(__type(__y), __type(__x));
179     }
180
181   using ::ceil;
182
183   inline float
184   ceil(float __x)
185   { return __builtin_ceilf(__x); }
186
187   inline long double
188   ceil(long double __x)
189   { return __builtin_ceill(__x); }
190
191   template<typename _Tp>
192     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
193                                            double>::__type
194     ceil(_Tp __x)
195     { return __builtin_ceil(__x); }
196
197   using ::cos;
198
199   inline float
200   cos(float __x)
201   { return __builtin_cosf(__x); }
202
203   inline long double
204   cos(long double __x)
205   { return __builtin_cosl(__x); }
206
207   template<typename _Tp>
208     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
209                                            double>::__type
210     cos(_Tp __x)
211     { return __builtin_cos(__x); }
212
213   using ::cosh;
214
215   inline float
216   cosh(float __x)
217   { return __builtin_coshf(__x); }
218
219   inline long double
220   cosh(long double __x)
221   { return __builtin_coshl(__x); }
222
223   template<typename _Tp>
224     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
225                                            double>::__type
226     cosh(_Tp __x)
227     { return __builtin_cosh(__x); }
228
229   using ::exp;
230
231   inline float
232   exp(float __x)
233   { return __builtin_expf(__x); }
234
235   inline long double
236   exp(long double __x)
237   { return __builtin_expl(__x); }
238
239   template<typename _Tp>
240     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
241                                            double>::__type
242     exp(_Tp __x)
243     { return __builtin_exp(__x); }
244
245   using ::fabs;
246
247   inline float
248   fabs(float __x)
249   { return __builtin_fabsf(__x); }
250
251   inline long double
252   fabs(long double __x)
253   { return __builtin_fabsl(__x); }
254
255   template<typename _Tp>
256     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
257                                            double>::__type
258     fabs(_Tp __x)
259     { return __builtin_fabs(__x); }
260
261   using ::floor;
262
263   inline float
264   floor(float __x)
265   { return __builtin_floorf(__x); }
266
267   inline long double
268   floor(long double __x)
269   { return __builtin_floorl(__x); }
270
271   template<typename _Tp>
272     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
273                                            double>::__type
274     floor(_Tp __x)
275     { return __builtin_floor(__x); }
276
277   using ::fmod;
278
279   inline float
280   fmod(float __x, float __y)
281   { return __builtin_fmodf(__x, __y); }
282
283   inline long double
284   fmod(long double __x, long double __y)
285   { return __builtin_fmodl(__x, __y); }
286
287   using ::frexp;
288
289   inline float
290   frexp(float __x, int* __exp)
291   { return __builtin_frexpf(__x, __exp); }
292
293   inline long double
294   frexp(long double __x, int* __exp)
295   { return __builtin_frexpl(__x, __exp); }
296
297   template<typename _Tp>
298     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
299                                            double>::__type
300     frexp(_Tp __x, int* __exp)
301     { return __builtin_frexp(__x, __exp); }
302
303   using ::ldexp;
304
305   inline float
306   ldexp(float __x, int __exp)
307   { return __builtin_ldexpf(__x, __exp); }
308
309   inline long double
310   ldexp(long double __x, int __exp)
311   { return __builtin_ldexpl(__x, __exp); }
312
313   template<typename _Tp>
314     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
315                                            double>::__type
316   ldexp(_Tp __x, int __exp)
317   { return __builtin_ldexp(__x, __exp); }
318
319   using ::log;
320
321   inline float
322   log(float __x)
323   { return __builtin_logf(__x); }
324
325   inline long double
326   log(long double __x)
327   { return __builtin_logl(__x); }
328
329   template<typename _Tp>
330     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
331                                            double>::__type
332     log(_Tp __x)
333     { return __builtin_log(__x); }
334
335   using ::log10;
336
337   inline float
338   log10(float __x)
339   { return __builtin_log10f(__x); }
340
341   inline long double
342   log10(long double __x)
343   { return __builtin_log10l(__x); }
344
345   template<typename _Tp>
346     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
347                                            double>::__type
348     log10(_Tp __x)
349     { return __builtin_log10(__x); }
350
351   using ::modf;
352
353   inline float
354   modf(float __x, float* __iptr)
355   { return __builtin_modff(__x, __iptr); }
356
357   inline long double
358   modf(long double __x, long double* __iptr)
359   { return __builtin_modfl(__x, __iptr); }
360
361   using ::pow;
362
363   inline float
364   pow(float __x, float __y)
365   { return __builtin_powf(__x, __y); }
366
367   inline long double
368   pow(long double __x, long double __y)
369   { return __builtin_powl(__x, __y); }
370
371 #ifndef __GXX_EXPERIMENTAL_CXX0X__
372   // _GLIBCXX_RESOLVE_LIB_DEFECTS
373   // DR 550. What should the return type of pow(float,int) be?
374   inline double
375   pow(double __x, int __i)
376   { return __builtin_powi(__x, __i); }
377
378   inline float
379   pow(float __x, int __n)
380   { return __builtin_powif(__x, __n); }
381
382   inline long double
383   pow(long double __x, int __n)
384   { return __builtin_powil(__x, __n); }
385 #endif
386
387   template<typename _Tp, typename _Up>
388     inline
389     typename __gnu_cxx::__promote_2<
390     typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value
391                                     && __is_arithmetic<_Up>::__value,
392                                     _Tp>::__type, _Up>::__type
393     pow(_Tp __x, _Up __y)
394     {
395       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
396       return pow(__type(__x), __type(__y));
397     }
398
399   using ::sin;
400
401   inline float
402   sin(float __x)
403   { return __builtin_sinf(__x); }
404
405   inline long double
406   sin(long double __x)
407   { return __builtin_sinl(__x); }
408
409   template<typename _Tp>
410     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
411                                            double>::__type
412     sin(_Tp __x)
413     { return __builtin_sin(__x); }
414
415   using ::sinh;
416
417   inline float
418   sinh(float __x)
419   { return __builtin_sinhf(__x); }
420
421   inline long double
422   sinh(long double __x)
423   { return __builtin_sinhl(__x); }
424
425   template<typename _Tp>
426     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
427                                            double>::__type
428     sinh(_Tp __x)
429     { return __builtin_sinh(__x); }
430
431   using ::sqrt;
432
433   inline float
434   sqrt(float __x)
435   { return __builtin_sqrtf(__x); }
436
437   inline long double
438   sqrt(long double __x)
439   { return __builtin_sqrtl(__x); }
440
441   template<typename _Tp>
442     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
443                                            double>::__type
444     sqrt(_Tp __x)
445     { return __builtin_sqrt(__x); }
446
447   using ::tan;
448
449   inline float
450   tan(float __x)
451   { return __builtin_tanf(__x); }
452
453   inline long double
454   tan(long double __x)
455   { return __builtin_tanl(__x); }
456
457   template<typename _Tp>
458     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
459                                            double>::__type
460     tan(_Tp __x)
461     { return __builtin_tan(__x); }
462
463   using ::tanh;
464
465   inline float
466   tanh(float __x)
467   { return __builtin_tanhf(__x); }
468
469   inline long double
470   tanh(long double __x)
471   { return __builtin_tanhl(__x); }
472
473   template<typename _Tp>
474     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
475                                            double>::__type
476     tanh(_Tp __x)
477     { return __builtin_tanh(__x); }
478
479 _GLIBCXX_END_NAMESPACE
480
481 #if _GLIBCXX_USE_C99_MATH
482 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
483
484 // These are possible macros imported from C99-land.
485 #undef fpclassify
486 #undef isfinite
487 #undef isinf
488 #undef isnan
489 #undef isnormal
490 #undef signbit
491 #undef isgreater
492 #undef isgreaterequal
493 #undef isless
494 #undef islessequal
495 #undef islessgreater
496 #undef isunordered
497
498 _GLIBCXX_BEGIN_NAMESPACE(std)
499
500 #ifdef __GXX_EXPERIMENTAL_CXX0X__
501   inline int
502   fpclassify(float __x)
503   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
504                                 FP_SUBNORMAL, FP_ZERO, __x); }
505
506   inline int
507   fpclassify(double __x)
508   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
509                                 FP_SUBNORMAL, FP_ZERO, __x); }
510
511   inline int
512   fpclassify(long double __x)
513   { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
514                                 FP_SUBNORMAL, FP_ZERO, __x); }
515
516   template<typename _Tp>
517     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
518                                            int>::__type
519     fpclassify(_Tp __x)
520     { return __x != 0 ? FP_NORMAL : FP_ZERO; }
521
522   inline bool
523   isfinite(float __x)
524   { return __builtin_isfinite(__x); }
525
526   inline bool
527   isfinite(double __x)
528   { return __builtin_isfinite(__x); }
529
530   inline bool
531   isfinite(long double __x)
532   { return __builtin_isfinite(__x); }
533
534   template<typename _Tp>
535     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
536                                            bool>::__type
537     isfinite(_Tp __x)
538     { return true; }
539
540   inline bool
541   isinf(float __x)
542   { return __builtin_isinf(__x); }
543
544   inline bool
545   isinf(double __x)
546   { return __builtin_isinf(__x); }
547
548   inline bool
549   isinf(long double __x)
550   { return __builtin_isinf(__x); }
551
552   template<typename _Tp>
553     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
554                                            bool>::__type
555     isinf(_Tp __x)
556     { return false; }
557
558   inline bool
559   isnan(float __x)
560   { return __builtin_isnan(__x); }
561
562   inline bool
563   isnan(double __x)
564   { return __builtin_isnan(__x); }
565
566   inline bool
567   isnan(long double __x)
568   { return __builtin_isnan(__x); }
569
570   template<typename _Tp>
571     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
572                                            bool>::__type
573     isnan(_Tp __x)
574     { return false; }
575
576   inline bool
577   isnormal(float __x)
578   { return __builtin_isnormal(__x); }
579
580   inline bool
581   isnormal(double __x)
582   { return __builtin_isnormal(__x); }
583
584   inline bool
585   isnormal(long double __x)
586   { return __builtin_isnormal(__x); }
587
588   template<typename _Tp>
589     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
590                                            bool>::__type
591     isnormal(_Tp __x)
592     { return __x != 0 ? true : false; }
593
594   inline bool
595   signbit(float __x)
596   { return __builtin_signbit(__x); }
597
598   inline bool
599   signbit(double __x)
600   { return __builtin_signbit(__x); }
601
602   inline bool
603   signbit(long double __x)
604   { return __builtin_signbit(__x); }
605
606   template<typename _Tp>
607     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
608                                            bool>::__type
609     signbit(_Tp __x)
610     { return __x < 0 ? true : false; }
611
612   inline bool
613   isgreater(float __x, float __y)
614   { return __builtin_isgreater(__x, __y); }
615
616   inline bool
617   isgreater(double __x, double __y)
618   { return __builtin_isgreater(__x, __y); }
619
620   inline bool
621   isgreater(long double __x, long double __y)
622   { return __builtin_isgreater(__x, __y); }
623
624   template<typename _Tp, typename _Up>
625     inline typename
626     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
627                             && __is_arithmetic<_Up>::__value), bool>::__type
628     isgreater(_Tp __x, _Up __y)
629     {
630       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
631       return __builtin_isgreater(__type(__x), __type(__y));
632     }
633
634   inline bool
635   isgreaterequal(float __x, float __y)
636   { return __builtin_isgreaterequal(__x, __y); }
637
638   inline bool
639   isgreaterequal(double __x, double __y)
640   { return __builtin_isgreaterequal(__x, __y); }
641
642   inline bool
643   isgreaterequal(long double __x, long double __y)
644   { return __builtin_isgreaterequal(__x, __y); }
645
646   template<typename _Tp, typename _Up>
647     inline typename
648     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
649                             && __is_arithmetic<_Up>::__value), bool>::__type
650     isgreaterequal(_Tp __x, _Up __y)
651     {
652       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
653       return __builtin_isgreaterequal(__type(__x), __type(__y));
654     }
655
656   inline bool
657   isless(float __x, float __y)
658   { return __builtin_isless(__x, __y); }
659
660   inline bool
661   isless(double __x, double __y)
662   { return __builtin_isless(__x, __y); }
663
664   inline bool
665   isless(long double __x, long double __y)
666   { return __builtin_isless(__x, __y); }
667
668   template<typename _Tp, typename _Up>
669     inline typename
670     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
671                             && __is_arithmetic<_Up>::__value), bool>::__type
672     isless(_Tp __x, _Up __y)
673     {
674       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
675       return __builtin_isless(__type(__x), __type(__y));
676     }
677
678   inline bool
679   islessequal(float __x, float __y)
680   { return __builtin_islessequal(__x, __y); }
681
682   inline bool
683   islessequal(double __x, double __y)
684   { return __builtin_islessequal(__x, __y); }
685
686   inline bool
687   islessequal(long double __x, long double __y)
688   { return __builtin_islessequal(__x, __y); }
689
690   template<typename _Tp, typename _Up>
691     inline typename
692     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
693                             && __is_arithmetic<_Up>::__value), bool>::__type
694     islessequal(_Tp __x, _Up __y)
695     {
696       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
697       return __builtin_islessequal(__type(__x), __type(__y));
698     }
699
700   inline bool
701   islessgreater(float __x, float __y)
702   { return __builtin_islessgreater(__x, __y); }
703
704   inline bool
705   islessgreater(double __x, double __y)
706   { return __builtin_islessgreater(__x, __y); }
707
708   inline bool
709   islessgreater(long double __x, long double __y)
710   { return __builtin_islessgreater(__x, __y); }
711
712   template<typename _Tp, typename _Up>
713     inline typename
714     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
715                             && __is_arithmetic<_Up>::__value), bool>::__type
716     islessgreater(_Tp __x, _Up __y)
717     {
718       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
719       return __builtin_islessgreater(__type(__x), __type(__y));
720     }
721
722   inline bool
723   isunordered(float __x, float __y)
724   { return __builtin_isunordered(__x, __y); }
725
726   inline bool
727   isunordered(double __x, double __y)
728   { return __builtin_isunordered(__x, __y); }
729
730   inline bool
731   isunordered(long double __x, long double __y)
732   { return __builtin_isunordered(__x, __y); }
733
734   template<typename _Tp, typename _Up>
735     inline typename
736     __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
737                             && __is_arithmetic<_Up>::__value), bool>::__type
738     isunordered(_Tp __x, _Up __y)
739     {
740       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
741       return __builtin_isunordered(__type(__x), __type(__y));
742     }
743
744 #else
745
746   template<typename _Tp>
747     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
748                                            int>::__type
749     fpclassify(_Tp __f)
750     {
751       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
752       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
753                                   FP_SUBNORMAL, FP_ZERO, __type(__f));
754     }
755
756   template<typename _Tp>
757     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
758                                            int>::__type
759     isfinite(_Tp __f)
760     {
761       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
762       return __builtin_isfinite(__type(__f));
763     }
764
765   template<typename _Tp>
766     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
767                                            int>::__type
768     isinf(_Tp __f)
769     {
770       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
771       return __builtin_isinf(__type(__f));
772     }
773
774   template<typename _Tp>
775     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
776                                            int>::__type
777     isnan(_Tp __f)
778     {
779       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
780       return __builtin_isnan(__type(__f));
781     }
782
783   template<typename _Tp>
784     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
785                                            int>::__type
786     isnormal(_Tp __f)
787     {
788       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
789       return __builtin_isnormal(__type(__f));
790     }
791
792   template<typename _Tp>
793     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
794                                            int>::__type
795     signbit(_Tp __f)
796     {
797       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
798       return __builtin_signbit(__type(__f));
799     }
800
801   template<typename _Tp>
802     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
803                                            int>::__type
804     isgreater(_Tp __f1, _Tp __f2)
805     {
806       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
807       return __builtin_isgreater(__type(__f1), __type(__f2));
808     }
809
810   template<typename _Tp>
811     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
812                                            int>::__type
813     isgreaterequal(_Tp __f1, _Tp __f2)
814     {
815       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
816       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
817     }
818
819   template<typename _Tp>
820     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
821                                            int>::__type
822     isless(_Tp __f1, _Tp __f2)
823     {
824       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
825       return __builtin_isless(__type(__f1), __type(__f2));
826     }
827
828   template<typename _Tp>
829     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
830                                            int>::__type
831     islessequal(_Tp __f1, _Tp __f2)
832     {
833       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
834       return __builtin_islessequal(__type(__f1), __type(__f2));
835     }
836
837   template<typename _Tp>
838     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
839                                            int>::__type
840     islessgreater(_Tp __f1, _Tp __f2)
841     {
842       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
843       return __builtin_islessgreater(__type(__f1), __type(__f2));
844     }
845
846   template<typename _Tp>
847     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
848                                            int>::__type
849     isunordered(_Tp __f1, _Tp __f2)
850     {
851       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
852       return __builtin_isunordered(__type(__f1), __type(__f2));
853     }
854
855 #endif
856
857 _GLIBCXX_END_NAMESPACE
858
859 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
860 #endif
861
862 #ifndef _GLIBCXX_EXPORT_TEMPLATE
863 # include <bits/cmath.tcc>
864 #endif
865
866 #ifdef __GXX_EXPERIMENTAL_CXX0X__
867 #  if defined(_GLIBCXX_INCLUDE_AS_TR1)
868 #    error C++0x header cannot be included from TR1 header
869 #  endif
870 #  if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
871 #    include <tr1_impl/cmath>
872 #  else
873 #    define _GLIBCXX_INCLUDE_AS_CXX0X
874 #    define _GLIBCXX_BEGIN_NAMESPACE_TR1
875 #    define _GLIBCXX_END_NAMESPACE_TR1
876 #    define _GLIBCXX_TR1
877 #    include <tr1_impl/cmath>
878 #    undef _GLIBCXX_TR1
879 #    undef _GLIBCXX_END_NAMESPACE_TR1
880 #    undef _GLIBCXX_BEGIN_NAMESPACE_TR1
881 #    undef _GLIBCXX_INCLUDE_AS_CXX0X
882 #  endif
883 #endif
884
885 #endif