tr1_impl/cmath

Go to the documentation of this file.
00001 // TR1 cmath -*- C++ -*-
00002 
00003 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /** @file tr1_impl/cmath
00026  *  This is an internal header file, included by other library headers.
00027  *  You should not attempt to use it directly.
00028  */
00029 
00030 #if _GLIBCXX_USE_C99_MATH_TR1
00031 
00032 #undef acosh
00033 #undef acoshf
00034 #undef acoshl
00035 #undef asinh
00036 #undef asinhf
00037 #undef asinhl
00038 #undef atanh
00039 #undef atanhf
00040 #undef atanhl
00041 #undef cbrt
00042 #undef cbrtf
00043 #undef cbrtl
00044 #undef copysign
00045 #undef copysignf
00046 #undef copysignl
00047 #undef erf
00048 #undef erff
00049 #undef erfl
00050 #undef erfc
00051 #undef erfcf
00052 #undef erfcl
00053 #undef exp2
00054 #undef exp2f
00055 #undef exp2l
00056 #undef expm1
00057 #undef expm1f
00058 #undef expm1l
00059 #undef fdim
00060 #undef fdimf
00061 #undef fdiml
00062 #undef fma
00063 #undef fmaf
00064 #undef fmal
00065 #undef fmax
00066 #undef fmaxf
00067 #undef fmaxl
00068 #undef fmin
00069 #undef fminf
00070 #undef fminl
00071 #undef hypot
00072 #undef hypotf
00073 #undef hypotl
00074 #undef ilogb
00075 #undef ilogbf
00076 #undef ilogbl
00077 #undef lgamma
00078 #undef lgammaf
00079 #undef lgammal
00080 #undef llrint
00081 #undef llrintf
00082 #undef llrintl
00083 #undef llround
00084 #undef llroundf
00085 #undef llroundl
00086 #undef log1p
00087 #undef log1pf
00088 #undef log1pl
00089 #undef log2
00090 #undef log2f
00091 #undef log2l
00092 #undef logb
00093 #undef logbf
00094 #undef logbl
00095 #undef lrint
00096 #undef lrintf
00097 #undef lrintl
00098 #undef lround
00099 #undef lroundf
00100 #undef lroundl
00101 #undef nan
00102 #undef nanf
00103 #undef nanl
00104 #undef nearbyint
00105 #undef nearbyintf
00106 #undef nearbyintl
00107 #undef nextafter
00108 #undef nextafterf
00109 #undef nextafterl
00110 #undef nexttoward
00111 #undef nexttowardf
00112 #undef nexttowardl
00113 #undef remainder
00114 #undef remainderf
00115 #undef remainderl
00116 #undef remquo
00117 #undef remquof
00118 #undef remquol
00119 #undef rint
00120 #undef rintf
00121 #undef rintl
00122 #undef round
00123 #undef roundf
00124 #undef roundl
00125 #undef scalbln
00126 #undef scalblnf
00127 #undef scalblnl
00128 #undef scalbn
00129 #undef scalbnf
00130 #undef scalbnl
00131 #undef tgamma
00132 #undef tgammaf
00133 #undef tgammal
00134 #undef trunc
00135 #undef truncf
00136 #undef truncl
00137 
00138 #endif
00139 
00140 namespace std
00141 {
00142 _GLIBCXX_BEGIN_NAMESPACE_TR1
00143 
00144 #if _GLIBCXX_USE_C99_MATH_TR1
00145 
00146   // types
00147   using ::double_t;
00148   using ::float_t;
00149 
00150   // functions
00151   using ::acosh;
00152   using ::acoshf;
00153   using ::acoshl;
00154 
00155   using ::asinh;
00156   using ::asinhf;
00157   using ::asinhl;
00158 
00159   using ::atanh;
00160   using ::atanhf;
00161   using ::atanhl;
00162 
00163   using ::cbrt;
00164   using ::cbrtf;
00165   using ::cbrtl;
00166 
00167   using ::copysign;
00168   using ::copysignf;
00169   using ::copysignl;
00170 
00171   using ::erf;
00172   using ::erff;
00173   using ::erfl;
00174 
00175   using ::erfc;
00176   using ::erfcf;
00177   using ::erfcl;
00178 
00179   using ::exp2;
00180   using ::exp2f;
00181   using ::exp2l;
00182 
00183   using ::expm1;
00184   using ::expm1f;
00185   using ::expm1l;
00186 
00187   using ::fdim;
00188   using ::fdimf;
00189   using ::fdiml;
00190 
00191   using ::fma;
00192   using ::fmaf;
00193   using ::fmal;
00194 
00195   using ::fmax;
00196   using ::fmaxf;
00197   using ::fmaxl;
00198 
00199   using ::fmin;
00200   using ::fminf;
00201   using ::fminl;
00202 
00203   using ::hypot;
00204   using ::hypotf;
00205   using ::hypotl;
00206 
00207   using ::ilogb;
00208   using ::ilogbf;
00209   using ::ilogbl;
00210 
00211   using ::lgamma;
00212   using ::lgammaf;
00213   using ::lgammal;
00214 
00215   using ::llrint;
00216   using ::llrintf;
00217   using ::llrintl;
00218 
00219   using ::llround;
00220   using ::llroundf;
00221   using ::llroundl;
00222 
00223   using ::log1p;
00224   using ::log1pf;
00225   using ::log1pl;
00226 
00227   using ::log2;
00228   using ::log2f;
00229   using ::log2l;
00230 
00231   using ::logb;
00232   using ::logbf;
00233   using ::logbl;
00234 
00235   using ::lrint;
00236   using ::lrintf;
00237   using ::lrintl;
00238 
00239   using ::lround;
00240   using ::lroundf;
00241   using ::lroundl;
00242 
00243   using ::nan;
00244   using ::nanf;
00245   using ::nanl;
00246 
00247   using ::nearbyint;
00248   using ::nearbyintf;
00249   using ::nearbyintl;
00250 
00251   using ::nextafter;
00252   using ::nextafterf;
00253   using ::nextafterl;
00254 
00255   using ::nexttoward;
00256   using ::nexttowardf;
00257   using ::nexttowardl;
00258 
00259   using ::remainder;
00260   using ::remainderf;
00261   using ::remainderl;
00262 
00263   using ::remquo;
00264   using ::remquof;
00265   using ::remquol;
00266 
00267   using ::rint;
00268   using ::rintf;
00269   using ::rintl;
00270 
00271   using ::round;
00272   using ::roundf;
00273   using ::roundl;
00274 
00275   using ::scalbln;
00276   using ::scalblnf;
00277   using ::scalblnl;
00278 
00279   using ::scalbn;
00280   using ::scalbnf;
00281   using ::scalbnl;
00282 
00283   using ::tgamma;
00284   using ::tgammaf;
00285   using ::tgammal;
00286 
00287   using ::trunc;
00288   using ::truncf;
00289   using ::truncl;
00290 
00291 #endif
00292 
00293 #if _GLIBCXX_USE_C99_MATH
00294 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
00295 
00296   /// Function template definitions [8.16.3].
00297   template<typename _Tp>
00298     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00299                        int>::__type
00300     fpclassify(_Tp __f)
00301     {
00302       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00303       return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
00304                   FP_SUBNORMAL, FP_ZERO, __type(__f));
00305     }
00306 
00307   template<typename _Tp>
00308     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00309                        int>::__type
00310     isfinite(_Tp __f)
00311     {
00312       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00313       return __builtin_isfinite(__type(__f));
00314     }
00315 
00316   template<typename _Tp>
00317     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00318                        int>::__type
00319     isinf(_Tp __f)
00320     {
00321       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00322       return __builtin_isinf(__type(__f));
00323     }
00324 
00325   template<typename _Tp>
00326     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00327                        int>::__type
00328     isnan(_Tp __f)
00329     {
00330       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00331       return __builtin_isnan(__type(__f));
00332     }
00333 
00334   template<typename _Tp>
00335     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00336                        int>::__type
00337     isnormal(_Tp __f)
00338     {
00339       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00340       return __builtin_isnormal(__type(__f));
00341     }
00342 
00343   template<typename _Tp>
00344     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00345                        int>::__type
00346     signbit(_Tp __f)
00347     {
00348       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00349       return __builtin_signbit(__type(__f));
00350     }
00351 
00352   template<typename _Tp>
00353     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00354                        int>::__type
00355     isgreater(_Tp __f1, _Tp __f2)
00356     {
00357       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00358       return __builtin_isgreater(__type(__f1), __type(__f2));
00359     }
00360 
00361   template<typename _Tp>
00362     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00363                        int>::__type
00364     isgreaterequal(_Tp __f1, _Tp __f2)
00365     {
00366       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00367       return __builtin_isgreaterequal(__type(__f1), __type(__f2));
00368     }
00369 
00370   template<typename _Tp>
00371     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00372                        int>::__type
00373     isless(_Tp __f1, _Tp __f2)
00374     {
00375       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00376       return __builtin_isless(__type(__f1), __type(__f2));
00377     }
00378 
00379   template<typename _Tp>
00380     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00381                        int>::__type
00382     islessequal(_Tp __f1, _Tp __f2)
00383     {
00384       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00385       return __builtin_islessequal(__type(__f1), __type(__f2));
00386     }
00387 
00388   template<typename _Tp>
00389     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00390                        int>::__type
00391     islessgreater(_Tp __f1, _Tp __f2)
00392     {
00393       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00394       return __builtin_islessgreater(__type(__f1), __type(__f2));
00395     }
00396 
00397   template<typename _Tp>
00398     inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
00399                        int>::__type
00400     isunordered(_Tp __f1, _Tp __f2)
00401     {
00402       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00403       return __builtin_isunordered(__type(__f1), __type(__f2));
00404     }
00405 
00406 #endif
00407 #endif
00408 
00409 #if _GLIBCXX_USE_C99_MATH_TR1
00410 
00411   /// Additional overloads [8.16.4].
00412   using std::acos;
00413 
00414   inline float
00415   acosh(float __x)
00416   { return __builtin_acoshf(__x); }
00417 
00418   inline long double
00419   acosh(long double __x)
00420   { return __builtin_acoshl(__x); }
00421 
00422   template<typename _Tp>
00423     inline typename __gnu_cxx::__promote<_Tp>::__type 
00424     acosh(_Tp __x)
00425     {
00426       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00427       return acosh(__type(__x));
00428     }
00429 
00430   using std::asin;
00431 
00432   inline float
00433   asinh(float __x)
00434   { return __builtin_asinhf(__x); }
00435 
00436   inline long double
00437   asinh(long double __x)
00438   { return __builtin_asinhl(__x); }
00439 
00440   template<typename _Tp>
00441     inline typename __gnu_cxx::__promote<_Tp>::__type 
00442     asinh(_Tp __x)
00443     {
00444       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00445       return asinh(__type(__x));
00446     }
00447 
00448   using std::atan;
00449   using std::atan2;
00450 
00451   inline float
00452   atanh(float __x)
00453   { return __builtin_atanhf(__x); }
00454 
00455   inline long double
00456   atanh(long double __x)
00457   { return __builtin_atanhl(__x); }
00458 
00459   template<typename _Tp>
00460     inline typename __gnu_cxx::__promote<_Tp>::__type 
00461     atanh(_Tp __x)
00462     {
00463       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00464       return atanh(__type(__x));
00465     }
00466 
00467   inline float
00468   cbrt(float __x)
00469   { return __builtin_cbrtf(__x); }
00470 
00471   inline long double
00472   cbrt(long double __x)
00473   { return __builtin_cbrtl(__x); }
00474 
00475   template<typename _Tp>
00476     inline typename __gnu_cxx::__promote<_Tp>::__type 
00477     cbrt(_Tp __x)
00478     {
00479       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00480       return cbrt(__type(__x));
00481     }
00482 
00483   using std::ceil;
00484 
00485   inline float
00486   copysign(float __x, float __y)
00487   { return __builtin_copysignf(__x, __y); }
00488 
00489   inline long double
00490   copysign(long double __x, long double __y)
00491   { return __builtin_copysignl(__x, __y); }
00492 
00493   template<typename _Tp, typename _Up>
00494     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00495     copysign(_Tp __x, _Up __y)
00496     {
00497       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00498       return copysign(__type(__x), __type(__y));
00499     }
00500 
00501   using std::cos;
00502   using std::cosh;  
00503 
00504   inline float
00505   erf(float __x)
00506   { return __builtin_erff(__x); }
00507 
00508   inline long double
00509   erf(long double __x)
00510   { return __builtin_erfl(__x); }
00511 
00512   template<typename _Tp>
00513     inline typename __gnu_cxx::__promote<_Tp>::__type 
00514     erf(_Tp __x)
00515     {
00516       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00517       return erf(__type(__x));
00518     }
00519 
00520   inline float
00521   erfc(float __x)
00522   { return __builtin_erfcf(__x); }
00523 
00524   inline long double
00525   erfc(long double __x)
00526   { return __builtin_erfcl(__x); }
00527 
00528   template<typename _Tp>
00529     inline typename __gnu_cxx::__promote<_Tp>::__type 
00530     erfc(_Tp __x)
00531     {
00532       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00533       return erfc(__type(__x));
00534     }
00535 
00536   using std::exp;
00537 
00538   inline float
00539   exp2(float __x)
00540   { return __builtin_exp2f(__x); }
00541 
00542   inline long double
00543   exp2(long double __x)
00544   { return __builtin_exp2l(__x); }
00545 
00546   template<typename _Tp>
00547     inline typename __gnu_cxx::__promote<_Tp>::__type 
00548     exp2(_Tp __x)
00549     {
00550       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00551       return exp2(__type(__x));
00552     }
00553 
00554   inline float
00555   expm1(float __x)
00556   { return __builtin_expm1f(__x); }
00557 
00558   inline long double
00559   expm1(long double __x)
00560   { return __builtin_expm1l(__x); }
00561 
00562   template<typename _Tp>
00563     inline typename __gnu_cxx::__promote<_Tp>::__type 
00564     expm1(_Tp __x)
00565     {
00566       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00567       return expm1(__type(__x));
00568     }
00569 
00570   using std::fabs;
00571 
00572   inline float
00573   fdim(float __x, float __y)
00574   { return __builtin_fdimf(__x, __y); }
00575 
00576   inline long double
00577   fdim(long double __x, long double __y)
00578   { return __builtin_fdiml(__x, __y); }
00579 
00580   template<typename _Tp, typename _Up>
00581     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00582     fdim(_Tp __x, _Up __y)
00583     {
00584       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00585       return fdim(__type(__x), __type(__y));
00586     }
00587 
00588   using std::floor;
00589 
00590   inline float
00591   fma(float __x, float __y, float __z)
00592   { return __builtin_fmaf(__x, __y, __z); }
00593 
00594   inline long double
00595   fma(long double __x, long double __y, long double __z)
00596   { return __builtin_fmal(__x, __y, __z); }
00597 
00598   template<typename _Tp, typename _Up, typename _Vp>
00599     inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
00600     fma(_Tp __x, _Up __y, _Vp __z)
00601     {
00602       typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
00603       return fma(__type(__x), __type(__y), __type(__z));
00604     }
00605 
00606   inline float
00607   fmax(float __x, float __y)
00608   { return __builtin_fmaxf(__x, __y); }
00609 
00610   inline long double
00611   fmax(long double __x, long double __y)
00612   { return __builtin_fmaxl(__x, __y); }
00613 
00614   template<typename _Tp, typename _Up>
00615     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00616     fmax(_Tp __x, _Up __y)
00617     {
00618       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00619       return fmax(__type(__x), __type(__y));
00620     }
00621 
00622   inline float
00623   fmin(float __x, float __y)
00624   { return __builtin_fminf(__x, __y); }
00625 
00626   inline long double
00627   fmin(long double __x, long double __y)
00628   { return __builtin_fminl(__x, __y); }
00629 
00630   template<typename _Tp, typename _Up>
00631     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00632     fmin(_Tp __x, _Up __y)
00633     {
00634       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00635       return fmin(__type(__x), __type(__y));
00636     }
00637 
00638   using std::fmod;
00639   using std::frexp;
00640 
00641   inline float
00642   hypot(float __x, float __y)
00643   { return __builtin_hypotf(__x, __y); }
00644 
00645   inline long double
00646   hypot(long double __x, long double __y)
00647   { return __builtin_hypotl(__x, __y); }
00648 
00649   template<typename _Tp, typename _Up>
00650     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00651     hypot(_Tp __x, _Up __y)
00652     {
00653       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00654       return hypot(__type(__x), __type(__y));
00655     }
00656 
00657   inline int
00658   ilogb(float __x)
00659   { return __builtin_ilogbf(__x); }
00660 
00661   inline int
00662   ilogb(long double __x)
00663   { return __builtin_ilogbl(__x); }
00664 
00665   template<typename _Tp>
00666     inline int
00667     ilogb(_Tp __x)
00668     {
00669       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00670       return ilogb(__type(__x));
00671     }
00672 
00673   using std::ldexp;
00674 
00675   inline float
00676   lgamma(float __x)
00677   { return __builtin_lgammaf(__x); }
00678 
00679   inline long double
00680   lgamma(long double __x)
00681   { return __builtin_lgammal(__x); }
00682 
00683   template<typename _Tp>
00684     inline typename __gnu_cxx::__promote<_Tp>::__type 
00685     lgamma(_Tp __x)
00686     {
00687       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00688       return lgamma(__type(__x));
00689     }
00690 
00691   inline long long
00692   llrint(float __x)
00693   { return __builtin_llrintf(__x); }
00694 
00695   inline long long
00696   llrint(long double __x)
00697   { return __builtin_llrintl(__x); }
00698 
00699   template<typename _Tp>
00700     inline long long
00701     llrint(_Tp __x)
00702     {
00703       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00704       return llrint(__type(__x));
00705     }
00706 
00707   inline long long
00708   llround(float __x)
00709   { return __builtin_llroundf(__x); }
00710 
00711   inline long long
00712   llround(long double __x)
00713   { return __builtin_llroundl(__x); }
00714 
00715   template<typename _Tp>
00716     inline long long
00717     llround(_Tp __x)
00718     {
00719       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00720       return llround(__type(__x));
00721     }
00722 
00723   using std::log;
00724   using std::log10;
00725 
00726   inline float
00727   log1p(float __x)
00728   { return __builtin_log1pf(__x); }
00729 
00730   inline long double
00731   log1p(long double __x)
00732   { return __builtin_log1pl(__x); }
00733 
00734   template<typename _Tp>
00735     inline typename __gnu_cxx::__promote<_Tp>::__type 
00736     log1p(_Tp __x)
00737     {
00738       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00739       return log1p(__type(__x));
00740     }
00741 
00742   // DR 568.
00743   inline float
00744   log2(float __x)
00745   { return __builtin_log2f(__x); }
00746 
00747   inline long double
00748   log2(long double __x)
00749   { return __builtin_log2l(__x); }
00750 
00751   template<typename _Tp>
00752     inline typename __gnu_cxx::__promote<_Tp>::__type 
00753     log2(_Tp __x)
00754     {
00755       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00756       return log2(__type(__x));
00757     }
00758 
00759   inline float
00760   logb(float __x)
00761   { return __builtin_logbf(__x); }
00762 
00763   inline long double
00764   logb(long double __x)
00765   { return __builtin_logbl(__x); }
00766 
00767   template<typename _Tp>
00768     inline typename __gnu_cxx::__promote<_Tp>::__type 
00769     logb(_Tp __x)
00770     {
00771       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00772       return logb(__type(__x));
00773     }
00774 
00775   inline long
00776   lrint(float __x)
00777   { return __builtin_lrintf(__x); }
00778 
00779   inline long
00780   lrint(long double __x)
00781   { return __builtin_lrintl(__x); }
00782 
00783   template<typename _Tp>
00784     inline long
00785     lrint(_Tp __x)
00786     {
00787       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00788       return lrint(__type(__x));
00789     }
00790 
00791   inline long
00792   lround(float __x)
00793   { return __builtin_lroundf(__x); }
00794 
00795   inline long
00796   lround(long double __x)
00797   { return __builtin_lroundl(__x); }
00798 
00799   template<typename _Tp>
00800     inline long
00801     lround(_Tp __x)
00802     {
00803       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00804       return lround(__type(__x));
00805     }
00806 
00807   inline float
00808   nearbyint(float __x)
00809   { return __builtin_nearbyintf(__x); }
00810 
00811   inline long double
00812   nearbyint(long double __x)
00813   { return __builtin_nearbyintl(__x); }
00814 
00815   template<typename _Tp>
00816     inline typename __gnu_cxx::__promote<_Tp>::__type 
00817     nearbyint(_Tp __x)
00818     {
00819       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00820       return nearbyint(__type(__x));
00821     }
00822 
00823   inline float
00824   nextafter(float __x, float __y)
00825   { return __builtin_nextafterf(__x, __y); }
00826 
00827   inline long double
00828   nextafter(long double __x, long double __y)
00829   { return __builtin_nextafterl(__x, __y); }
00830 
00831   template<typename _Tp, typename _Up>
00832     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00833     nextafter(_Tp __x, _Up __y)
00834     {
00835       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00836       return nextafter(__type(__x), __type(__y));
00837     }
00838 
00839   inline float
00840   nexttoward(float __x, long double __y)
00841   { return __builtin_nexttowardf(__x, __y); }
00842 
00843   inline long double
00844   nexttoward(long double __x, long double __y)
00845   { return __builtin_nexttowardl(__x, __y); }
00846 
00847   template<typename _Tp>
00848     inline typename __gnu_cxx::__promote<_Tp>::__type
00849     nexttoward(_Tp __x, long double __y)
00850     {
00851       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00852       return nexttoward(__type(__x), __y);
00853     }
00854 
00855   // DR 550. What should the return type of pow(float,int) be?
00856   // NB: C++0x and TR1 != C++03.
00857   //   using std::pow;
00858 
00859   inline float
00860   remainder(float __x, float __y)
00861   { return __builtin_remainderf(__x, __y); }
00862 
00863   inline long double
00864   remainder(long double __x, long double __y)
00865   { return __builtin_remainderl(__x, __y); }
00866 
00867   template<typename _Tp, typename _Up>
00868     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00869     remainder(_Tp __x, _Up __y)
00870     {
00871       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00872       return remainder(__type(__x), __type(__y));
00873     }
00874 
00875   inline float
00876   remquo(float __x, float __y, int* __pquo)
00877   { return __builtin_remquof(__x, __y, __pquo); }
00878 
00879   inline long double
00880   remquo(long double __x, long double __y, int* __pquo)
00881   { return __builtin_remquol(__x, __y, __pquo); }
00882 
00883   template<typename _Tp, typename _Up>
00884     inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
00885     remquo(_Tp __x, _Up __y, int* __pquo)
00886     {
00887       typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
00888       return remquo(__type(__x), __type(__y), __pquo);
00889     }
00890 
00891   inline float
00892   rint(float __x)
00893   { return __builtin_rintf(__x); }
00894 
00895   inline long double
00896   rint(long double __x)
00897   { return __builtin_rintl(__x); }
00898 
00899   template<typename _Tp>
00900     inline typename __gnu_cxx::__promote<_Tp>::__type
00901     rint(_Tp __x)
00902     {
00903       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00904       return rint(__type(__x));
00905     }
00906 
00907   inline float
00908   round(float __x)
00909   { return __builtin_roundf(__x); }
00910 
00911   inline long double
00912   round(long double __x)
00913   { return __builtin_roundl(__x); }
00914 
00915   template<typename _Tp>
00916     inline typename __gnu_cxx::__promote<_Tp>::__type
00917     round(_Tp __x)
00918     {
00919       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00920       return round(__type(__x));
00921     }
00922 
00923   inline float
00924   scalbln(float __x, long __ex)
00925   { return __builtin_scalblnf(__x, __ex); }
00926 
00927   inline long double
00928   scalbln(long double __x, long __ex)
00929   { return __builtin_scalblnl(__x, __ex); }
00930 
00931   template<typename _Tp>
00932     inline typename __gnu_cxx::__promote<_Tp>::__type 
00933     scalbln(_Tp __x, long __ex)
00934     {
00935       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00936       return scalbln(__type(__x), __ex);
00937     }
00938  
00939   inline float
00940   scalbn(float __x, int __ex)
00941   { return __builtin_scalbnf(__x, __ex); }
00942 
00943   inline long double
00944   scalbn(long double __x, int __ex)
00945   { return __builtin_scalbnl(__x, __ex); }
00946 
00947   template<typename _Tp>
00948     inline typename __gnu_cxx::__promote<_Tp>::__type 
00949     scalbn(_Tp __x, int __ex)
00950     {
00951       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00952       return scalbn(__type(__x), __ex);
00953     }
00954 
00955   using std::sin;
00956   using std::sinh;
00957   using std::sqrt;
00958   using std::tan;
00959   using std::tanh;
00960 
00961   inline float
00962   tgamma(float __x)
00963   { return __builtin_tgammaf(__x); }
00964 
00965   inline long double
00966   tgamma(long double __x)
00967   { return __builtin_tgammal(__x); }
00968 
00969   template<typename _Tp>
00970     inline typename __gnu_cxx::__promote<_Tp>::__type 
00971     tgamma(_Tp __x)
00972     {
00973       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00974       return tgamma(__type(__x));
00975     }
00976  
00977   inline float
00978   trunc(float __x)
00979   { return __builtin_truncf(__x); }
00980 
00981   inline long double
00982   trunc(long double __x)
00983   { return __builtin_truncl(__x); }
00984 
00985   template<typename _Tp>
00986     inline typename __gnu_cxx::__promote<_Tp>::__type 
00987     trunc(_Tp __x)
00988     {
00989       typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
00990       return trunc(__type(__x));
00991     }
00992 
00993 #endif
00994 
00995 _GLIBCXX_END_NAMESPACE_TR1
00996 }