xref: /openbsd-src/gnu/gcc/libstdc++-v3/include/c_std/std_cmath.h (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert // -*- C++ -*- C forwarding header.
2*404b540aSrobert 
3*404b540aSrobert // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
4*404b540aSrobert // Free Software Foundation, Inc.
5*404b540aSrobert //
6*404b540aSrobert // This file is part of the GNU ISO C++ Library.  This library is free
7*404b540aSrobert // software; you can redistribute it and/or modify it under the
8*404b540aSrobert // terms of the GNU General Public License as published by the
9*404b540aSrobert // Free Software Foundation; either version 2, or (at your option)
10*404b540aSrobert // any later version.
11*404b540aSrobert 
12*404b540aSrobert // This library is distributed in the hope that it will be useful,
13*404b540aSrobert // but WITHOUT ANY WARRANTY; without even the implied warranty of
14*404b540aSrobert // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*404b540aSrobert // GNU General Public License for more details.
16*404b540aSrobert 
17*404b540aSrobert // You should have received a copy of the GNU General Public License along
18*404b540aSrobert // with this library; see the file COPYING.  If not, write to the Free
19*404b540aSrobert // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20*404b540aSrobert // USA.
21*404b540aSrobert 
22*404b540aSrobert // As a special exception, you may use this file as part of a free software
23*404b540aSrobert // library without restriction.  Specifically, if other files instantiate
24*404b540aSrobert // templates or use macros or inline functions from this file, or you compile
25*404b540aSrobert // this file and link it with other files to produce an executable, this
26*404b540aSrobert // file does not by itself cause the resulting executable to be covered by
27*404b540aSrobert // the GNU General Public License.  This exception does not however
28*404b540aSrobert // invalidate any other reasons why the executable file might be covered by
29*404b540aSrobert // the GNU General Public License.
30*404b540aSrobert 
31*404b540aSrobert /** @file include/cmath
32*404b540aSrobert  *  This is a Standard C++ Library file.  You should @c #include this file
33*404b540aSrobert  *  in your programs, rather than any of the "*.h" implementation files.
34*404b540aSrobert  *
35*404b540aSrobert  *  This is the C++ version of the Standard C Library header @c math.h,
36*404b540aSrobert  *  and its contents are (mostly) the same as that header, but are all
37*404b540aSrobert  *  contained in the namespace @c std (except for names which are defined
38*404b540aSrobert  *  as macros in C).
39*404b540aSrobert  */
40*404b540aSrobert 
41*404b540aSrobert //
42*404b540aSrobert // ISO C++ 14882: 26.5  C library
43*404b540aSrobert //
44*404b540aSrobert 
45*404b540aSrobert #ifndef _GLIBCXX_CMATH
46*404b540aSrobert #define _GLIBCXX_CMATH 1
47*404b540aSrobert 
48*404b540aSrobert #pragma GCC system_header
49*404b540aSrobert 
50*404b540aSrobert #include <bits/c++config.h>
51*404b540aSrobert #include <bits/cpp_type_traits.h>
52*404b540aSrobert #include <ext/type_traits.h>
53*404b540aSrobert 
54*404b540aSrobert #include <math.h>
55*404b540aSrobert 
56*404b540aSrobert // Get rid of those macros defined in <math.h> in lieu of real functions.
57*404b540aSrobert #undef abs
58*404b540aSrobert #undef div
59*404b540aSrobert #undef acos
60*404b540aSrobert #undef asin
61*404b540aSrobert #undef atan
62*404b540aSrobert #undef atan2
63*404b540aSrobert #undef ceil
64*404b540aSrobert #undef cos
65*404b540aSrobert #undef cosh
66*404b540aSrobert #undef exp
67*404b540aSrobert #undef fabs
68*404b540aSrobert #undef floor
69*404b540aSrobert #undef fmod
70*404b540aSrobert #undef frexp
71*404b540aSrobert #undef ldexp
72*404b540aSrobert #undef log
73*404b540aSrobert #undef log10
74*404b540aSrobert #undef modf
75*404b540aSrobert #undef pow
76*404b540aSrobert #undef sin
77*404b540aSrobert #undef sinh
78*404b540aSrobert #undef sqrt
79*404b540aSrobert #undef tan
80*404b540aSrobert #undef tanh
81*404b540aSrobert 
82*404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
83*404b540aSrobert 
84*404b540aSrobert   // Forward declaration of a helper function.  This really should be
85*404b540aSrobert   // an `exported' forward declaration.
86*404b540aSrobert   template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);
87*404b540aSrobert 
88*404b540aSrobert   inline double
abs(double __x)89*404b540aSrobert   abs(double __x)
90*404b540aSrobert   { return __builtin_fabs(__x); }
91*404b540aSrobert 
92*404b540aSrobert   inline float
abs(float __x)93*404b540aSrobert   abs(float __x)
94*404b540aSrobert   { return __builtin_fabsf(__x); }
95*404b540aSrobert 
96*404b540aSrobert   inline long double
abs(long double __x)97*404b540aSrobert   abs(long double __x)
98*404b540aSrobert   { return __builtin_fabsl(__x); }
99*404b540aSrobert 
100*404b540aSrobert   using ::acos;
101*404b540aSrobert 
102*404b540aSrobert   inline float
acos(float __x)103*404b540aSrobert   acos(float __x)
104*404b540aSrobert   { return __builtin_acosf(__x); }
105*404b540aSrobert 
106*404b540aSrobert   inline long double
acos(long double __x)107*404b540aSrobert   acos(long double __x)
108*404b540aSrobert   { return __builtin_acosl(__x); }
109*404b540aSrobert 
110*404b540aSrobert   template<typename _Tp>
111*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
112*404b540aSrobert 					   double>::__type
acos(_Tp __x)113*404b540aSrobert     acos(_Tp __x)
114*404b540aSrobert     { return __builtin_acos(__x); }
115*404b540aSrobert 
116*404b540aSrobert   using ::asin;
117*404b540aSrobert 
118*404b540aSrobert   inline float
asin(float __x)119*404b540aSrobert   asin(float __x)
120*404b540aSrobert   { return __builtin_asinf(__x); }
121*404b540aSrobert 
122*404b540aSrobert   inline long double
asin(long double __x)123*404b540aSrobert   asin(long double __x)
124*404b540aSrobert   { return __builtin_asinl(__x); }
125*404b540aSrobert 
126*404b540aSrobert   template<typename _Tp>
127*404b540aSrobert   inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
128*404b540aSrobert 					 double>::__type
asin(_Tp __x)129*404b540aSrobert     asin(_Tp __x)
130*404b540aSrobert     { return __builtin_asin(__x); }
131*404b540aSrobert 
132*404b540aSrobert   using ::atan;
133*404b540aSrobert 
134*404b540aSrobert   inline float
atan(float __x)135*404b540aSrobert   atan(float __x)
136*404b540aSrobert   { return __builtin_atanf(__x); }
137*404b540aSrobert 
138*404b540aSrobert   inline long double
atan(long double __x)139*404b540aSrobert   atan(long double __x)
140*404b540aSrobert   { return __builtin_atanl(__x); }
141*404b540aSrobert 
142*404b540aSrobert   template<typename _Tp>
143*404b540aSrobert   inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
144*404b540aSrobert 					 double>::__type
atan(_Tp __x)145*404b540aSrobert     atan(_Tp __x)
146*404b540aSrobert     { return __builtin_atan(__x); }
147*404b540aSrobert 
148*404b540aSrobert   using ::atan2;
149*404b540aSrobert 
150*404b540aSrobert   inline float
atan2(float __y,float __x)151*404b540aSrobert   atan2(float __y, float __x)
152*404b540aSrobert   { return __builtin_atan2f(__y, __x); }
153*404b540aSrobert 
154*404b540aSrobert   inline long double
atan2(long double __y,long double __x)155*404b540aSrobert   atan2(long double __y, long double __x)
156*404b540aSrobert   { return __builtin_atan2l(__y, __x); }
157*404b540aSrobert 
158*404b540aSrobert   template<typename _Tp, typename _Up>
159*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value
160*404b540aSrobert     					   && __is_integer<_Up>::__value,
161*404b540aSrobert 					   double>::__type
atan2(_Tp __y,_Up __x)162*404b540aSrobert     atan2(_Tp __y, _Up __x)
163*404b540aSrobert     { return __builtin_atan2(__y, __x); }
164*404b540aSrobert 
165*404b540aSrobert   using ::ceil;
166*404b540aSrobert 
167*404b540aSrobert   inline float
ceil(float __x)168*404b540aSrobert   ceil(float __x)
169*404b540aSrobert   { return __builtin_ceilf(__x); }
170*404b540aSrobert 
171*404b540aSrobert   inline long double
ceil(long double __x)172*404b540aSrobert   ceil(long double __x)
173*404b540aSrobert   { return __builtin_ceill(__x); }
174*404b540aSrobert 
175*404b540aSrobert   template<typename _Tp>
176*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
177*404b540aSrobert 					   double>::__type
ceil(_Tp __x)178*404b540aSrobert     ceil(_Tp __x)
179*404b540aSrobert     { return __builtin_ceil(__x); }
180*404b540aSrobert 
181*404b540aSrobert   using ::cos;
182*404b540aSrobert 
183*404b540aSrobert   inline float
cos(float __x)184*404b540aSrobert   cos(float __x)
185*404b540aSrobert   { return __builtin_cosf(__x); }
186*404b540aSrobert 
187*404b540aSrobert   inline long double
cos(long double __x)188*404b540aSrobert   cos(long double __x)
189*404b540aSrobert   { return __builtin_cosl(__x); }
190*404b540aSrobert 
191*404b540aSrobert   template<typename _Tp>
192*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
193*404b540aSrobert 					   double>::__type
cos(_Tp __x)194*404b540aSrobert     cos(_Tp __x)
195*404b540aSrobert     { return __builtin_cos(__x); }
196*404b540aSrobert 
197*404b540aSrobert   using ::cosh;
198*404b540aSrobert 
199*404b540aSrobert   inline float
cosh(float __x)200*404b540aSrobert   cosh(float __x)
201*404b540aSrobert   { return __builtin_coshf(__x); }
202*404b540aSrobert 
203*404b540aSrobert   inline long double
cosh(long double __x)204*404b540aSrobert   cosh(long double __x)
205*404b540aSrobert   { return __builtin_coshl(__x); }
206*404b540aSrobert 
207*404b540aSrobert   template<typename _Tp>
208*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
209*404b540aSrobert 					   double>::__type
cosh(_Tp __x)210*404b540aSrobert     cosh(_Tp __x)
211*404b540aSrobert     { return __builtin_cosh(__x); }
212*404b540aSrobert 
213*404b540aSrobert   using ::exp;
214*404b540aSrobert 
215*404b540aSrobert   inline float
exp(float __x)216*404b540aSrobert   exp(float __x)
217*404b540aSrobert   { return __builtin_expf(__x); }
218*404b540aSrobert 
219*404b540aSrobert   inline long double
exp(long double __x)220*404b540aSrobert   exp(long double __x)
221*404b540aSrobert   { return __builtin_expl(__x); }
222*404b540aSrobert 
223*404b540aSrobert   template<typename _Tp>
224*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
225*404b540aSrobert 					   double>::__type
exp(_Tp __x)226*404b540aSrobert     exp(_Tp __x)
227*404b540aSrobert     { return __builtin_exp(__x); }
228*404b540aSrobert 
229*404b540aSrobert   using ::fabs;
230*404b540aSrobert 
231*404b540aSrobert   inline float
fabs(float __x)232*404b540aSrobert   fabs(float __x)
233*404b540aSrobert   { return __builtin_fabsf(__x); }
234*404b540aSrobert 
235*404b540aSrobert   inline long double
fabs(long double __x)236*404b540aSrobert   fabs(long double __x)
237*404b540aSrobert   { return __builtin_fabsl(__x); }
238*404b540aSrobert 
239*404b540aSrobert   template<typename _Tp>
240*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
241*404b540aSrobert 					   double>::__type
fabs(_Tp __x)242*404b540aSrobert     fabs(_Tp __x)
243*404b540aSrobert     { return __builtin_fabs(__x); }
244*404b540aSrobert 
245*404b540aSrobert   using ::floor;
246*404b540aSrobert 
247*404b540aSrobert   inline float
floor(float __x)248*404b540aSrobert   floor(float __x)
249*404b540aSrobert   { return __builtin_floorf(__x); }
250*404b540aSrobert 
251*404b540aSrobert   inline long double
floor(long double __x)252*404b540aSrobert   floor(long double __x)
253*404b540aSrobert   { return __builtin_floorl(__x); }
254*404b540aSrobert 
255*404b540aSrobert   template<typename _Tp>
256*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
257*404b540aSrobert 					   double>::__type
floor(_Tp __x)258*404b540aSrobert     floor(_Tp __x)
259*404b540aSrobert     { return __builtin_floor(__x); }
260*404b540aSrobert 
261*404b540aSrobert   using ::fmod;
262*404b540aSrobert 
263*404b540aSrobert   inline float
fmod(float __x,float __y)264*404b540aSrobert   fmod(float __x, float __y)
265*404b540aSrobert   { return __builtin_fmodf(__x, __y); }
266*404b540aSrobert 
267*404b540aSrobert   inline long double
fmod(long double __x,long double __y)268*404b540aSrobert   fmod(long double __x, long double __y)
269*404b540aSrobert   { return __builtin_fmodl(__x, __y); }
270*404b540aSrobert 
271*404b540aSrobert   using ::frexp;
272*404b540aSrobert 
273*404b540aSrobert   inline float
frexp(float __x,int * __exp)274*404b540aSrobert   frexp(float __x, int* __exp)
275*404b540aSrobert   { return __builtin_frexpf(__x, __exp); }
276*404b540aSrobert 
277*404b540aSrobert   inline long double
frexp(long double __x,int * __exp)278*404b540aSrobert   frexp(long double __x, int* __exp)
279*404b540aSrobert   { return __builtin_frexpl(__x, __exp); }
280*404b540aSrobert 
281*404b540aSrobert   template<typename _Tp>
282*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
283*404b540aSrobert 					   double>::__type
frexp(_Tp __x,int * __exp)284*404b540aSrobert     frexp(_Tp __x, int* __exp)
285*404b540aSrobert     { return __builtin_frexp(__x, __exp); }
286*404b540aSrobert 
287*404b540aSrobert   using ::ldexp;
288*404b540aSrobert 
289*404b540aSrobert   inline float
ldexp(float __x,int __exp)290*404b540aSrobert   ldexp(float __x, int __exp)
291*404b540aSrobert   { return __builtin_ldexpf(__x, __exp); }
292*404b540aSrobert 
293*404b540aSrobert   inline long double
ldexp(long double __x,int __exp)294*404b540aSrobert   ldexp(long double __x, int __exp)
295*404b540aSrobert   { return __builtin_ldexpl(__x, __exp); }
296*404b540aSrobert 
297*404b540aSrobert   template<typename _Tp>
298*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
299*404b540aSrobert 					   double>::__type
ldexp(_Tp __x,int __exp)300*404b540aSrobert   ldexp(_Tp __x, int __exp)
301*404b540aSrobert   { return __builtin_ldexp(__x, __exp); }
302*404b540aSrobert 
303*404b540aSrobert   using ::log;
304*404b540aSrobert 
305*404b540aSrobert   inline float
log(float __x)306*404b540aSrobert   log(float __x)
307*404b540aSrobert   { return __builtin_logf(__x); }
308*404b540aSrobert 
309*404b540aSrobert   inline long double
log(long double __x)310*404b540aSrobert   log(long double __x)
311*404b540aSrobert   { return __builtin_logl(__x); }
312*404b540aSrobert 
313*404b540aSrobert   template<typename _Tp>
314*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
315*404b540aSrobert 					   double>::__type
log(_Tp __x)316*404b540aSrobert     log(_Tp __x)
317*404b540aSrobert     { return __builtin_log(__x); }
318*404b540aSrobert 
319*404b540aSrobert   using ::log10;
320*404b540aSrobert 
321*404b540aSrobert   inline float
log10(float __x)322*404b540aSrobert   log10(float __x)
323*404b540aSrobert   { return __builtin_log10f(__x); }
324*404b540aSrobert 
325*404b540aSrobert   inline long double
log10(long double __x)326*404b540aSrobert   log10(long double __x)
327*404b540aSrobert   { return __builtin_log10l(__x); }
328*404b540aSrobert 
329*404b540aSrobert   template<typename _Tp>
330*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
331*404b540aSrobert 					   double>::__type
log10(_Tp __x)332*404b540aSrobert     log10(_Tp __x)
333*404b540aSrobert     { return __builtin_log10(__x); }
334*404b540aSrobert 
335*404b540aSrobert   using ::modf;
336*404b540aSrobert 
337*404b540aSrobert   inline float
modf(float __x,float * __iptr)338*404b540aSrobert   modf(float __x, float* __iptr)
339*404b540aSrobert   { return __builtin_modff(__x, __iptr); }
340*404b540aSrobert 
341*404b540aSrobert   inline long double
modf(long double __x,long double * __iptr)342*404b540aSrobert   modf(long double __x, long double* __iptr)
343*404b540aSrobert   { return __builtin_modfl(__x, __iptr); }
344*404b540aSrobert 
345*404b540aSrobert   template<typename _Tp>
346*404b540aSrobert     inline _Tp
__pow_helper(_Tp __x,int __n)347*404b540aSrobert     __pow_helper(_Tp __x, int __n)
348*404b540aSrobert     {
349*404b540aSrobert       return __n < 0
350*404b540aSrobert         ? _Tp(1)/__cmath_power(__x, -__n)
351*404b540aSrobert         : __cmath_power(__x, __n);
352*404b540aSrobert     }
353*404b540aSrobert 
354*404b540aSrobert   using ::pow;
355*404b540aSrobert 
356*404b540aSrobert   inline float
pow(float __x,float __y)357*404b540aSrobert   pow(float __x, float __y)
358*404b540aSrobert   { return __builtin_powf(__x, __y); }
359*404b540aSrobert 
360*404b540aSrobert   inline long double
pow(long double __x,long double __y)361*404b540aSrobert   pow(long double __x, long double __y)
362*404b540aSrobert   { return __builtin_powl(__x, __y); }
363*404b540aSrobert 
364*404b540aSrobert   inline double
pow(double __x,int __i)365*404b540aSrobert   pow(double __x, int __i)
366*404b540aSrobert   { return __builtin_powi(__x, __i); }
367*404b540aSrobert 
368*404b540aSrobert   inline float
pow(float __x,int __n)369*404b540aSrobert   pow(float __x, int __n)
370*404b540aSrobert   { return __builtin_powif(__x, __n); }
371*404b540aSrobert 
372*404b540aSrobert   inline long double
pow(long double __x,int __n)373*404b540aSrobert   pow(long double __x, int __n)
374*404b540aSrobert   { return __builtin_powil(__x, __n); }
375*404b540aSrobert 
376*404b540aSrobert   using ::sin;
377*404b540aSrobert 
378*404b540aSrobert   inline float
sin(float __x)379*404b540aSrobert   sin(float __x)
380*404b540aSrobert   { return __builtin_sinf(__x); }
381*404b540aSrobert 
382*404b540aSrobert   inline long double
sin(long double __x)383*404b540aSrobert   sin(long double __x)
384*404b540aSrobert   { return __builtin_sinl(__x); }
385*404b540aSrobert 
386*404b540aSrobert   template<typename _Tp>
387*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
388*404b540aSrobert 					   double>::__type
sin(_Tp __x)389*404b540aSrobert     sin(_Tp __x)
390*404b540aSrobert     { return __builtin_sin(__x); }
391*404b540aSrobert 
392*404b540aSrobert   using ::sinh;
393*404b540aSrobert 
394*404b540aSrobert   inline float
sinh(float __x)395*404b540aSrobert   sinh(float __x)
396*404b540aSrobert   { return __builtin_sinhf(__x); }
397*404b540aSrobert 
398*404b540aSrobert   inline long double
sinh(long double __x)399*404b540aSrobert   sinh(long double __x)
400*404b540aSrobert   { return __builtin_sinhl(__x); }
401*404b540aSrobert 
402*404b540aSrobert   template<typename _Tp>
403*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
404*404b540aSrobert 					   double>::__type
sinh(_Tp __x)405*404b540aSrobert     sinh(_Tp __x)
406*404b540aSrobert     { return __builtin_sinh(__x); }
407*404b540aSrobert 
408*404b540aSrobert   using ::sqrt;
409*404b540aSrobert 
410*404b540aSrobert   inline float
sqrt(float __x)411*404b540aSrobert   sqrt(float __x)
412*404b540aSrobert   { return __builtin_sqrtf(__x); }
413*404b540aSrobert 
414*404b540aSrobert   inline long double
sqrt(long double __x)415*404b540aSrobert   sqrt(long double __x)
416*404b540aSrobert   { return __builtin_sqrtl(__x); }
417*404b540aSrobert 
418*404b540aSrobert   template<typename _Tp>
419*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
420*404b540aSrobert 					   double>::__type
sqrt(_Tp __x)421*404b540aSrobert     sqrt(_Tp __x)
422*404b540aSrobert     { return __builtin_sqrt(__x); }
423*404b540aSrobert 
424*404b540aSrobert   using ::tan;
425*404b540aSrobert 
426*404b540aSrobert   inline float
tan(float __x)427*404b540aSrobert   tan(float __x)
428*404b540aSrobert   { return __builtin_tanf(__x); }
429*404b540aSrobert 
430*404b540aSrobert   inline long double
tan(long double __x)431*404b540aSrobert   tan(long double __x)
432*404b540aSrobert   { return __builtin_tanl(__x); }
433*404b540aSrobert 
434*404b540aSrobert   template<typename _Tp>
435*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
436*404b540aSrobert 					   double>::__type
tan(_Tp __x)437*404b540aSrobert     tan(_Tp __x)
438*404b540aSrobert     { return __builtin_tan(__x); }
439*404b540aSrobert 
440*404b540aSrobert   using ::tanh;
441*404b540aSrobert 
442*404b540aSrobert   inline float
tanh(float __x)443*404b540aSrobert   tanh(float __x)
444*404b540aSrobert   { return __builtin_tanhf(__x); }
445*404b540aSrobert 
446*404b540aSrobert   inline long double
tanh(long double __x)447*404b540aSrobert   tanh(long double __x)
448*404b540aSrobert   { return __builtin_tanhl(__x); }
449*404b540aSrobert 
450*404b540aSrobert   template<typename _Tp>
451*404b540aSrobert     inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
452*404b540aSrobert 					   double>::__type
tanh(_Tp __x)453*404b540aSrobert     tanh(_Tp __x)
454*404b540aSrobert     { return __builtin_tanh(__x); }
455*404b540aSrobert 
456*404b540aSrobert _GLIBCXX_END_NAMESPACE
457*404b540aSrobert 
458*404b540aSrobert #if _GLIBCXX_USE_C99_MATH
459*404b540aSrobert #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
460*404b540aSrobert // These are possible macros imported from C99-land. For strict
461*404b540aSrobert // conformance, remove possible C99-injected names from the global
462*404b540aSrobert // namespace, and sequester them in the __gnu_cxx extension namespace.
463*404b540aSrobert 
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)464*404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
465*404b540aSrobert 
466*404b540aSrobert   template<typename _Tp>
467*404b540aSrobert     inline int
468*404b540aSrobert     __capture_fpclassify(_Tp __f) { return fpclassify(__f); }
469*404b540aSrobert 
470*404b540aSrobert   template<typename _Tp>
471*404b540aSrobert     inline int
__capture_isfinite(_Tp __f)472*404b540aSrobert     __capture_isfinite(_Tp __f) { return isfinite(__f); }
473*404b540aSrobert 
474*404b540aSrobert   template<typename _Tp>
475*404b540aSrobert     inline int
__capture_isinf(_Tp __f)476*404b540aSrobert     __capture_isinf(_Tp __f) { return isinf(__f); }
477*404b540aSrobert 
478*404b540aSrobert   template<typename _Tp>
479*404b540aSrobert     inline int
__capture_isnan(_Tp __f)480*404b540aSrobert     __capture_isnan(_Tp __f) { return isnan(__f); }
481*404b540aSrobert 
482*404b540aSrobert   template<typename _Tp>
483*404b540aSrobert     inline int
__capture_isnormal(_Tp __f)484*404b540aSrobert     __capture_isnormal(_Tp __f) { return isnormal(__f); }
485*404b540aSrobert 
486*404b540aSrobert   template<typename _Tp>
487*404b540aSrobert     inline int
__capture_signbit(_Tp __f)488*404b540aSrobert     __capture_signbit(_Tp __f) { return signbit(__f); }
489*404b540aSrobert 
490*404b540aSrobert   template<typename _Tp>
491*404b540aSrobert     inline int
__capture_isgreater(_Tp __f1,_Tp __f2)492*404b540aSrobert     __capture_isgreater(_Tp __f1, _Tp __f2)
493*404b540aSrobert     { return isgreater(__f1, __f2); }
494*404b540aSrobert 
495*404b540aSrobert   template<typename _Tp>
496*404b540aSrobert     inline int
__capture_isgreaterequal(_Tp __f1,_Tp __f2)497*404b540aSrobert     __capture_isgreaterequal(_Tp __f1, _Tp __f2)
498*404b540aSrobert     { return isgreaterequal(__f1, __f2); }
499*404b540aSrobert 
500*404b540aSrobert   template<typename _Tp>
501*404b540aSrobert     inline int
__capture_isless(_Tp __f1,_Tp __f2)502*404b540aSrobert     __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }
503*404b540aSrobert 
504*404b540aSrobert   template<typename _Tp>
505*404b540aSrobert     inline int
__capture_islessequal(_Tp __f1,_Tp __f2)506*404b540aSrobert     __capture_islessequal(_Tp __f1, _Tp __f2)
507*404b540aSrobert     { return islessequal(__f1, __f2); }
508*404b540aSrobert 
509*404b540aSrobert   template<typename _Tp>
510*404b540aSrobert     inline int
__capture_islessgreater(_Tp __f1,_Tp __f2)511*404b540aSrobert     __capture_islessgreater(_Tp __f1, _Tp __f2)
512*404b540aSrobert     { return islessgreater(__f1, __f2); }
513*404b540aSrobert 
514*404b540aSrobert   template<typename _Tp>
515*404b540aSrobert     inline int
__capture_isunordered(_Tp __f1,_Tp __f2)516*404b540aSrobert     __capture_isunordered(_Tp __f1, _Tp __f2)
517*404b540aSrobert     { return isunordered(__f1, __f2); }
518*404b540aSrobert 
519*404b540aSrobert _GLIBCXX_END_NAMESPACE
520*404b540aSrobert 
521*404b540aSrobert // Only undefine the C99 FP macros, if actually captured for namespace movement
522*404b540aSrobert #undef fpclassify
523*404b540aSrobert #undef isfinite
524*404b540aSrobert #undef isinf
525*404b540aSrobert #undef isnan
526*404b540aSrobert #undef isnormal
527*404b540aSrobert #undef signbit
528*404b540aSrobert #undef isgreater
529*404b540aSrobert #undef isgreaterequal
530*404b540aSrobert #undef isless
531*404b540aSrobert #undef islessequal
532*404b540aSrobert #undef islessgreater
533*404b540aSrobert #undef isunordered
534*404b540aSrobert 
_GLIBCXX_BEGIN_NAMESPACE(std)535*404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std)
536*404b540aSrobert 
537*404b540aSrobert   template<typename _Tp>
538*404b540aSrobert     inline int
539*404b540aSrobert     fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); }
540*404b540aSrobert 
541*404b540aSrobert   template<typename _Tp>
542*404b540aSrobert     inline int
isfinite(_Tp __f)543*404b540aSrobert     isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }
544*404b540aSrobert 
545*404b540aSrobert   template<typename _Tp>
546*404b540aSrobert     inline int
isinf(_Tp __f)547*404b540aSrobert     isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); }
548*404b540aSrobert 
549*404b540aSrobert   template<typename _Tp>
550*404b540aSrobert     inline int
isnan(_Tp __f)551*404b540aSrobert     isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
552*404b540aSrobert 
553*404b540aSrobert   template<typename _Tp>
554*404b540aSrobert     inline int
isnormal(_Tp __f)555*404b540aSrobert     isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); }
556*404b540aSrobert 
557*404b540aSrobert   template<typename _Tp>
558*404b540aSrobert     inline int
signbit(_Tp __f)559*404b540aSrobert     signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); }
560*404b540aSrobert 
561*404b540aSrobert   template<typename _Tp>
562*404b540aSrobert     inline int
isgreater(_Tp __f1,_Tp __f2)563*404b540aSrobert     isgreater(_Tp __f1, _Tp __f2)
564*404b540aSrobert     { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); }
565*404b540aSrobert 
566*404b540aSrobert   template<typename _Tp>
567*404b540aSrobert     inline int
isgreaterequal(_Tp __f1,_Tp __f2)568*404b540aSrobert     isgreaterequal(_Tp __f1, _Tp __f2)
569*404b540aSrobert     { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); }
570*404b540aSrobert 
571*404b540aSrobert   template<typename _Tp>
572*404b540aSrobert     inline int
isless(_Tp __f1,_Tp __f2)573*404b540aSrobert     isless(_Tp __f1, _Tp __f2)
574*404b540aSrobert     { return ::__gnu_cxx::__capture_isless(__f1, __f2); }
575*404b540aSrobert 
576*404b540aSrobert   template<typename _Tp>
577*404b540aSrobert     inline int
islessequal(_Tp __f1,_Tp __f2)578*404b540aSrobert     islessequal(_Tp __f1, _Tp __f2)
579*404b540aSrobert     { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); }
580*404b540aSrobert 
581*404b540aSrobert   template<typename _Tp>
582*404b540aSrobert     inline int
islessgreater(_Tp __f1,_Tp __f2)583*404b540aSrobert     islessgreater(_Tp __f1, _Tp __f2)
584*404b540aSrobert     { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); }
585*404b540aSrobert 
586*404b540aSrobert   template<typename _Tp>
587*404b540aSrobert     inline int
isunordered(_Tp __f1,_Tp __f2)588*404b540aSrobert     isunordered(_Tp __f1, _Tp __f2)
589*404b540aSrobert     { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); }
590*404b540aSrobert 
591*404b540aSrobert _GLIBCXX_END_NAMESPACE
592*404b540aSrobert 
593*404b540aSrobert #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
594*404b540aSrobert #endif
595*404b540aSrobert 
596*404b540aSrobert #ifndef _GLIBCXX_EXPORT_TEMPLATE
597*404b540aSrobert # include <bits/cmath.tcc>
598*404b540aSrobert #endif
599*404b540aSrobert 
600*404b540aSrobert #endif
601