1*404b540aSrobert// TR1 cmath -*- C++ -*- 2*404b540aSrobert 3*404b540aSrobert// Copyright (C) 2006 Free Software Foundation, Inc. 4*404b540aSrobert// 5*404b540aSrobert// This file is part of the GNU ISO C++ Library. This library is free 6*404b540aSrobert// software; you can redistribute it and/or modify it under the 7*404b540aSrobert// terms of the GNU General Public License as published by the 8*404b540aSrobert// Free Software Foundation; either version 2, or (at your option) 9*404b540aSrobert// any later version. 10*404b540aSrobert 11*404b540aSrobert// This library is distributed in the hope that it will be useful, 12*404b540aSrobert// but WITHOUT ANY WARRANTY; without even the implied warranty of 13*404b540aSrobert// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*404b540aSrobert// GNU General Public License for more details. 15*404b540aSrobert 16*404b540aSrobert// You should have received a copy of the GNU General Public License along 17*404b540aSrobert// with this library; see the file COPYING. If not, write to the Free 18*404b540aSrobert// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 19*404b540aSrobert// USA. 20*404b540aSrobert 21*404b540aSrobert// As a special exception, you may use this file as part of a free software 22*404b540aSrobert// library without restriction. Specifically, if other files instantiate 23*404b540aSrobert// templates or use macros or inline functions from this file, or you compile 24*404b540aSrobert// this file and link it with other files to produce an executable, this 25*404b540aSrobert// file does not by itself cause the resulting executable to be covered by 26*404b540aSrobert// the GNU General Public License. This exception does not however 27*404b540aSrobert// invalidate any other reasons why the executable file might be covered by 28*404b540aSrobert// the GNU General Public License. 29*404b540aSrobert 30*404b540aSrobert/** @file tr1/cmath 31*404b540aSrobert * This is a TR1 C++ Library header. 32*404b540aSrobert */ 33*404b540aSrobert 34*404b540aSrobert#ifndef _TR1_CMATH 35*404b540aSrobert#define _TR1_CMATH 1 36*404b540aSrobert 37*404b540aSrobert#include <bits/c++config.h> 38*404b540aSrobert#include <cmath> 39*404b540aSrobert#include <tr1/common.h> 40*404b540aSrobert 41*404b540aSrobert#if _GLIBCXX_USE_C99_MATH_TR1 42*404b540aSrobert 43*404b540aSrobert#undef acosh 44*404b540aSrobert#undef acoshf 45*404b540aSrobert#undef acoshl 46*404b540aSrobert#undef asinh 47*404b540aSrobert#undef asinhf 48*404b540aSrobert#undef asinhl 49*404b540aSrobert#undef atanh 50*404b540aSrobert#undef atanhf 51*404b540aSrobert#undef atanhl 52*404b540aSrobert#undef cbrt 53*404b540aSrobert#undef cbrtf 54*404b540aSrobert#undef cbrtl 55*404b540aSrobert#undef copysign 56*404b540aSrobert#undef copysignf 57*404b540aSrobert#undef copysignl 58*404b540aSrobert#undef erf 59*404b540aSrobert#undef erff 60*404b540aSrobert#undef erfl 61*404b540aSrobert#undef erfc 62*404b540aSrobert#undef erfcf 63*404b540aSrobert#undef erfcl 64*404b540aSrobert#undef exp2 65*404b540aSrobert#undef exp2f 66*404b540aSrobert#undef exp2l 67*404b540aSrobert#undef expm1 68*404b540aSrobert#undef expm1f 69*404b540aSrobert#undef expm1l 70*404b540aSrobert#undef fdim 71*404b540aSrobert#undef fdimf 72*404b540aSrobert#undef fdiml 73*404b540aSrobert#undef fma 74*404b540aSrobert#undef fmaf 75*404b540aSrobert#undef fmal 76*404b540aSrobert#undef fmax 77*404b540aSrobert#undef fmaxf 78*404b540aSrobert#undef fmaxl 79*404b540aSrobert#undef fmin 80*404b540aSrobert#undef fminf 81*404b540aSrobert#undef fminl 82*404b540aSrobert#undef hypot 83*404b540aSrobert#undef hypotf 84*404b540aSrobert#undef hypotl 85*404b540aSrobert#undef ilogb 86*404b540aSrobert#undef ilogbf 87*404b540aSrobert#undef ilogbl 88*404b540aSrobert#undef lgamma 89*404b540aSrobert#undef lgammaf 90*404b540aSrobert#undef lgammal 91*404b540aSrobert#undef llrint 92*404b540aSrobert#undef llrintf 93*404b540aSrobert#undef llrintl 94*404b540aSrobert#undef llround 95*404b540aSrobert#undef llroundf 96*404b540aSrobert#undef llroundl 97*404b540aSrobert#undef log1p 98*404b540aSrobert#undef log1pf 99*404b540aSrobert#undef log1pl 100*404b540aSrobert#undef log2 101*404b540aSrobert#undef log2f 102*404b540aSrobert#undef log2l 103*404b540aSrobert#undef logb 104*404b540aSrobert#undef logbf 105*404b540aSrobert#undef logbl 106*404b540aSrobert#undef lrint 107*404b540aSrobert#undef lrintf 108*404b540aSrobert#undef lrintl 109*404b540aSrobert#undef lround 110*404b540aSrobert#undef lroundf 111*404b540aSrobert#undef lroundl 112*404b540aSrobert#undef nan 113*404b540aSrobert#undef nanf 114*404b540aSrobert#undef nanl 115*404b540aSrobert#undef nearbyint 116*404b540aSrobert#undef nearbyintf 117*404b540aSrobert#undef nearbyintl 118*404b540aSrobert#undef nextafter 119*404b540aSrobert#undef nextafterf 120*404b540aSrobert#undef nextafterl 121*404b540aSrobert#undef nexttoward 122*404b540aSrobert#undef nexttowardf 123*404b540aSrobert#undef nexttowardl 124*404b540aSrobert#undef remainder 125*404b540aSrobert#undef remainderf 126*404b540aSrobert#undef remainderl 127*404b540aSrobert#undef remquo 128*404b540aSrobert#undef remquo 129*404b540aSrobert#undef remquo 130*404b540aSrobert#undef rint 131*404b540aSrobert#undef rintf 132*404b540aSrobert#undef rintl 133*404b540aSrobert#undef round 134*404b540aSrobert#undef roundf 135*404b540aSrobert#undef roundl 136*404b540aSrobert#undef scalbln 137*404b540aSrobert#undef scalblnf 138*404b540aSrobert#undef scalblnl 139*404b540aSrobert#undef scalbn 140*404b540aSrobert#undef scalbnf 141*404b540aSrobert#undef scalbnl 142*404b540aSrobert#undef tgamma 143*404b540aSrobert#undef tgammaf 144*404b540aSrobert#undef tgammal 145*404b540aSrobert#undef trunc 146*404b540aSrobert#undef truncf 147*404b540aSrobert#undef truncl 148*404b540aSrobert 149*404b540aSrobert#endif 150*404b540aSrobert 151*404b540aSrobert// namespace std::tr1 152*404b540aSrobertnamespace std 153*404b540aSrobert{ 154*404b540aSrobert_GLIBCXX_BEGIN_NAMESPACE(tr1) 155*404b540aSrobert 156*404b540aSrobert#if _GLIBCXX_USE_C99_MATH_TR1 157*404b540aSrobert 158*404b540aSrobert // types 159*404b540aSrobert using ::double_t; 160*404b540aSrobert using ::float_t; 161*404b540aSrobert 162*404b540aSrobert // functions 163*404b540aSrobert using ::acosh; 164*404b540aSrobert using ::acoshf; 165*404b540aSrobert using ::acoshl; 166*404b540aSrobert 167*404b540aSrobert using ::asinh; 168*404b540aSrobert using ::asinhf; 169*404b540aSrobert using ::asinhl; 170*404b540aSrobert 171*404b540aSrobert using ::atanh; 172*404b540aSrobert using ::atanhf; 173*404b540aSrobert using ::atanhl; 174*404b540aSrobert 175*404b540aSrobert using ::cbrt; 176*404b540aSrobert using ::cbrtf; 177*404b540aSrobert using ::cbrtl; 178*404b540aSrobert 179*404b540aSrobert using ::copysign; 180*404b540aSrobert using ::copysignf; 181*404b540aSrobert using ::copysignl; 182*404b540aSrobert 183*404b540aSrobert using ::erf; 184*404b540aSrobert using ::erff; 185*404b540aSrobert using ::erfl; 186*404b540aSrobert 187*404b540aSrobert using ::erfc; 188*404b540aSrobert using ::erfcf; 189*404b540aSrobert using ::erfcl; 190*404b540aSrobert 191*404b540aSrobert using ::exp2; 192*404b540aSrobert using ::exp2f; 193*404b540aSrobert using ::exp2l; 194*404b540aSrobert 195*404b540aSrobert using ::expm1; 196*404b540aSrobert using ::expm1f; 197*404b540aSrobert using ::expm1l; 198*404b540aSrobert 199*404b540aSrobert using ::fdim; 200*404b540aSrobert using ::fdimf; 201*404b540aSrobert using ::fdiml; 202*404b540aSrobert 203*404b540aSrobert using ::fma; 204*404b540aSrobert using ::fmaf; 205*404b540aSrobert using ::fmal; 206*404b540aSrobert 207*404b540aSrobert using ::fmax; 208*404b540aSrobert using ::fmaxf; 209*404b540aSrobert using ::fmaxl; 210*404b540aSrobert 211*404b540aSrobert using ::fmin; 212*404b540aSrobert using ::fminf; 213*404b540aSrobert using ::fminl; 214*404b540aSrobert 215*404b540aSrobert using ::hypot; 216*404b540aSrobert using ::hypotf; 217*404b540aSrobert using ::hypotl; 218*404b540aSrobert 219*404b540aSrobert using ::ilogb; 220*404b540aSrobert using ::ilogbf; 221*404b540aSrobert using ::ilogbl; 222*404b540aSrobert 223*404b540aSrobert using ::lgamma; 224*404b540aSrobert using ::lgammaf; 225*404b540aSrobert using ::lgammal; 226*404b540aSrobert 227*404b540aSrobert using ::llrint; 228*404b540aSrobert using ::llrintf; 229*404b540aSrobert using ::llrintl; 230*404b540aSrobert 231*404b540aSrobert using ::llround; 232*404b540aSrobert using ::llroundf; 233*404b540aSrobert using ::llroundl; 234*404b540aSrobert 235*404b540aSrobert using ::log1p; 236*404b540aSrobert using ::log1pf; 237*404b540aSrobert using ::log1pl; 238*404b540aSrobert 239*404b540aSrobert using ::log2; 240*404b540aSrobert using ::log2f; 241*404b540aSrobert using ::log2l; 242*404b540aSrobert 243*404b540aSrobert using ::logb; 244*404b540aSrobert using ::logbf; 245*404b540aSrobert using ::logbl; 246*404b540aSrobert 247*404b540aSrobert using ::lrint; 248*404b540aSrobert using ::lrintf; 249*404b540aSrobert using ::lrintl; 250*404b540aSrobert 251*404b540aSrobert using ::lround; 252*404b540aSrobert using ::lroundf; 253*404b540aSrobert using ::lroundl; 254*404b540aSrobert 255*404b540aSrobert using ::nan; 256*404b540aSrobert using ::nanf; 257*404b540aSrobert using ::nanl; 258*404b540aSrobert 259*404b540aSrobert using ::nearbyint; 260*404b540aSrobert using ::nearbyintf; 261*404b540aSrobert using ::nearbyintl; 262*404b540aSrobert 263*404b540aSrobert using ::nextafter; 264*404b540aSrobert using ::nextafterf; 265*404b540aSrobert using ::nextafterl; 266*404b540aSrobert 267*404b540aSrobert using ::nexttoward; 268*404b540aSrobert using ::nexttowardf; 269*404b540aSrobert using ::nexttowardl; 270*404b540aSrobert 271*404b540aSrobert using ::remainder; 272*404b540aSrobert using ::remainderf; 273*404b540aSrobert using ::remainderl; 274*404b540aSrobert 275*404b540aSrobert using ::remquo; 276*404b540aSrobert using ::remquo; 277*404b540aSrobert using ::remquo; 278*404b540aSrobert 279*404b540aSrobert using ::rint; 280*404b540aSrobert using ::rintf; 281*404b540aSrobert using ::rintl; 282*404b540aSrobert 283*404b540aSrobert using ::round; 284*404b540aSrobert using ::roundf; 285*404b540aSrobert using ::roundl; 286*404b540aSrobert 287*404b540aSrobert using ::scalbln; 288*404b540aSrobert using ::scalblnf; 289*404b540aSrobert using ::scalblnl; 290*404b540aSrobert 291*404b540aSrobert using ::scalbn; 292*404b540aSrobert using ::scalbnf; 293*404b540aSrobert using ::scalbnl; 294*404b540aSrobert 295*404b540aSrobert using ::tgamma; 296*404b540aSrobert using ::tgammaf; 297*404b540aSrobert using ::tgammal; 298*404b540aSrobert 299*404b540aSrobert using ::trunc; 300*404b540aSrobert using ::truncf; 301*404b540aSrobert using ::truncl; 302*404b540aSrobert 303*404b540aSrobert#endif 304*404b540aSrobert 305*404b540aSrobert#if _GLIBCXX_USE_C99_MATH 306*404b540aSrobert#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC 307*404b540aSrobert 308*404b540aSrobert /// @brief Function template definitions [8.16.3]. 309*404b540aSrobert // 310*404b540aSrobert using std::signbit; 311*404b540aSrobert 312*404b540aSrobert using std::fpclassify; 313*404b540aSrobert 314*404b540aSrobert using std::isfinite; 315*404b540aSrobert using std::isinf; 316*404b540aSrobert using std::isnan; 317*404b540aSrobert using std::isnormal; 318*404b540aSrobert 319*404b540aSrobert using std::isgreater; 320*404b540aSrobert using std::isgreaterequal; 321*404b540aSrobert using std::isless; 322*404b540aSrobert using std::islessequal; 323*404b540aSrobert using std::islessgreater; 324*404b540aSrobert using std::isunordered; 325*404b540aSrobert#endif 326*404b540aSrobert#endif 327*404b540aSrobert 328*404b540aSrobert#if _GLIBCXX_USE_C99_MATH_TR1 329*404b540aSrobert 330*404b540aSrobert /// @brief Additional overloads [8.16.4]. 331*404b540aSrobert // 332*404b540aSrobert using std::acos; 333*404b540aSrobert 334*404b540aSrobert inline float 335*404b540aSrobert acosh(float __x) 336*404b540aSrobert { return __builtin_acoshf(__x); } 337*404b540aSrobert 338*404b540aSrobert inline long double 339*404b540aSrobert acosh(long double __x) 340*404b540aSrobert { return __builtin_acoshl(__x); } 341*404b540aSrobert 342*404b540aSrobert template<typename _Tp> 343*404b540aSrobert inline typename __promote<_Tp>::__type 344*404b540aSrobert acosh(_Tp __x) 345*404b540aSrobert { 346*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 347*404b540aSrobert return acosh(__type(__x)); 348*404b540aSrobert } 349*404b540aSrobert 350*404b540aSrobert using std::asin; 351*404b540aSrobert 352*404b540aSrobert inline float 353*404b540aSrobert asinh(float __x) 354*404b540aSrobert { return __builtin_asinhf(__x); } 355*404b540aSrobert 356*404b540aSrobert inline long double 357*404b540aSrobert asinh(long double __x) 358*404b540aSrobert { return __builtin_asinhl(__x); } 359*404b540aSrobert 360*404b540aSrobert template<typename _Tp> 361*404b540aSrobert inline typename __promote<_Tp>::__type 362*404b540aSrobert asinh(_Tp __x) 363*404b540aSrobert { 364*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 365*404b540aSrobert return asinh(__type(__x)); 366*404b540aSrobert } 367*404b540aSrobert 368*404b540aSrobert using std::atan; 369*404b540aSrobert 370*404b540aSrobert // Workaround for c++/21682. 371*404b540aSrobert namespace __detail 372*404b540aSrobert { 373*404b540aSrobert template<typename _Tp, typename _Up> 374*404b540aSrobert inline typename 375*404b540aSrobert __gnu_cxx::__enable_if<std::__is_floating<_Tp>::__value 376*404b540aSrobert || std::__is_floating<_Up>::__value, 377*404b540aSrobert typename 378*404b540aSrobert std::tr1::__promote_2<_Tp, _Up>::__type>::__type 379*404b540aSrobert atan2(_Tp __y, _Up __x) 380*404b540aSrobert { 381*404b540aSrobert typedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type; 382*404b540aSrobert return std::atan2(__type(__y), __type(__x)); 383*404b540aSrobert } 384*404b540aSrobert } // namespace __detail 385*404b540aSrobert 386*404b540aSrobert using std::atan2; 387*404b540aSrobert using __detail::atan2; 388*404b540aSrobert 389*404b540aSrobert inline float 390*404b540aSrobert atanh(float __x) 391*404b540aSrobert { return __builtin_atanhf(__x); } 392*404b540aSrobert 393*404b540aSrobert inline long double 394*404b540aSrobert atanh(long double __x) 395*404b540aSrobert { return __builtin_atanhl(__x); } 396*404b540aSrobert 397*404b540aSrobert template<typename _Tp> 398*404b540aSrobert inline typename __promote<_Tp>::__type 399*404b540aSrobert atanh(_Tp __x) 400*404b540aSrobert { 401*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 402*404b540aSrobert return atanh(__type(__x)); 403*404b540aSrobert } 404*404b540aSrobert 405*404b540aSrobert inline float 406*404b540aSrobert cbrt(float __x) 407*404b540aSrobert { return __builtin_cbrtf(__x); } 408*404b540aSrobert 409*404b540aSrobert inline long double 410*404b540aSrobert cbrt(long double __x) 411*404b540aSrobert { return __builtin_cbrtl(__x); } 412*404b540aSrobert 413*404b540aSrobert template<typename _Tp> 414*404b540aSrobert inline typename __promote<_Tp>::__type 415*404b540aSrobert cbrt(_Tp __x) 416*404b540aSrobert { 417*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 418*404b540aSrobert return cbrt(__type(__x)); 419*404b540aSrobert } 420*404b540aSrobert 421*404b540aSrobert using std::ceil; 422*404b540aSrobert 423*404b540aSrobert inline float 424*404b540aSrobert copysign(float __x, float __y) 425*404b540aSrobert { return __builtin_copysignf(__x, __y); } 426*404b540aSrobert 427*404b540aSrobert inline long double 428*404b540aSrobert copysign(long double __x, long double __y) 429*404b540aSrobert { return __builtin_copysignl(__x, __y); } 430*404b540aSrobert 431*404b540aSrobert template<typename _Tp, typename _Up> 432*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 433*404b540aSrobert copysign(_Tp __x, _Up __y) 434*404b540aSrobert { 435*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 436*404b540aSrobert return copysign(__type(__x), __type(__y)); 437*404b540aSrobert } 438*404b540aSrobert 439*404b540aSrobert using std::cos; 440*404b540aSrobert using std::cosh; 441*404b540aSrobert 442*404b540aSrobert inline float 443*404b540aSrobert erf(float __x) 444*404b540aSrobert { return __builtin_erff(__x); } 445*404b540aSrobert 446*404b540aSrobert inline long double 447*404b540aSrobert erf(long double __x) 448*404b540aSrobert { return __builtin_erfl(__x); } 449*404b540aSrobert 450*404b540aSrobert template<typename _Tp> 451*404b540aSrobert inline typename __promote<_Tp>::__type 452*404b540aSrobert erf(_Tp __x) 453*404b540aSrobert { 454*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 455*404b540aSrobert return erf(__type(__x)); 456*404b540aSrobert } 457*404b540aSrobert 458*404b540aSrobert inline float 459*404b540aSrobert erfc(float __x) 460*404b540aSrobert { return __builtin_erfcf(__x); } 461*404b540aSrobert 462*404b540aSrobert inline long double 463*404b540aSrobert erfc(long double __x) 464*404b540aSrobert { return __builtin_erfcl(__x); } 465*404b540aSrobert 466*404b540aSrobert template<typename _Tp> 467*404b540aSrobert inline typename __promote<_Tp>::__type 468*404b540aSrobert erfc(_Tp __x) 469*404b540aSrobert { 470*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 471*404b540aSrobert return erfc(__type(__x)); 472*404b540aSrobert } 473*404b540aSrobert 474*404b540aSrobert using std::exp; 475*404b540aSrobert 476*404b540aSrobert inline float 477*404b540aSrobert exp2(float __x) 478*404b540aSrobert { return __builtin_exp2f(__x); } 479*404b540aSrobert 480*404b540aSrobert inline long double 481*404b540aSrobert exp2(long double __x) 482*404b540aSrobert { return __builtin_exp2l(__x); } 483*404b540aSrobert 484*404b540aSrobert template<typename _Tp> 485*404b540aSrobert inline typename __promote<_Tp>::__type 486*404b540aSrobert exp2(_Tp __x) 487*404b540aSrobert { 488*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 489*404b540aSrobert return exp2(__type(__x)); 490*404b540aSrobert } 491*404b540aSrobert 492*404b540aSrobert inline float 493*404b540aSrobert expm1(float __x) 494*404b540aSrobert { return __builtin_expm1f(__x); } 495*404b540aSrobert 496*404b540aSrobert inline long double 497*404b540aSrobert expm1(long double __x) 498*404b540aSrobert { return __builtin_expm1l(__x); } 499*404b540aSrobert 500*404b540aSrobert template<typename _Tp> 501*404b540aSrobert inline typename __promote<_Tp>::__type 502*404b540aSrobert expm1(_Tp __x) 503*404b540aSrobert { 504*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 505*404b540aSrobert return expm1(__type(__x)); 506*404b540aSrobert } 507*404b540aSrobert 508*404b540aSrobert using std::fabs; 509*404b540aSrobert 510*404b540aSrobert inline float 511*404b540aSrobert fdim(float __x, float __y) 512*404b540aSrobert { return __builtin_fdimf(__x, __y); } 513*404b540aSrobert 514*404b540aSrobert inline long double 515*404b540aSrobert fdim(long double __x, long double __y) 516*404b540aSrobert { return __builtin_fdiml(__x, __y); } 517*404b540aSrobert 518*404b540aSrobert template<typename _Tp, typename _Up> 519*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 520*404b540aSrobert fdim(_Tp __x, _Up __y) 521*404b540aSrobert { 522*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 523*404b540aSrobert return fdim(__type(__x), __type(__y)); 524*404b540aSrobert } 525*404b540aSrobert 526*404b540aSrobert using std::floor; 527*404b540aSrobert 528*404b540aSrobert inline float 529*404b540aSrobert fma(float __x, float __y, float __z) 530*404b540aSrobert { return __builtin_fmaf(__x, __y, __z); } 531*404b540aSrobert 532*404b540aSrobert inline long double 533*404b540aSrobert fma(long double __x, long double __y, long double __z) 534*404b540aSrobert { return __builtin_fmal(__x, __y, __z); } 535*404b540aSrobert 536*404b540aSrobert template<typename _Tp, typename _Up, typename _Vp> 537*404b540aSrobert inline typename __promote_3<_Tp, _Up, _Vp>::__type 538*404b540aSrobert fma(_Tp __x, _Up __y, _Vp __z) 539*404b540aSrobert { 540*404b540aSrobert typedef typename __promote_3<_Tp, _Up, _Vp>::__type __type; 541*404b540aSrobert return fma(__type(__x), __type(__y), __type(__z)); 542*404b540aSrobert } 543*404b540aSrobert 544*404b540aSrobert inline float 545*404b540aSrobert fmax(float __x, float __y) 546*404b540aSrobert { return __builtin_fmaxf(__x, __y); } 547*404b540aSrobert 548*404b540aSrobert inline long double 549*404b540aSrobert fmax(long double __x, long double __y) 550*404b540aSrobert { return __builtin_fmaxl(__x, __y); } 551*404b540aSrobert 552*404b540aSrobert template<typename _Tp, typename _Up> 553*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 554*404b540aSrobert fmax(_Tp __x, _Up __y) 555*404b540aSrobert { 556*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 557*404b540aSrobert return fmax(__type(__x), __type(__y)); 558*404b540aSrobert } 559*404b540aSrobert 560*404b540aSrobert inline float 561*404b540aSrobert fmin(float __x, float __y) 562*404b540aSrobert { return __builtin_fminf(__x, __y); } 563*404b540aSrobert 564*404b540aSrobert inline long double 565*404b540aSrobert fmin(long double __x, long double __y) 566*404b540aSrobert { return __builtin_fminl(__x, __y); } 567*404b540aSrobert 568*404b540aSrobert template<typename _Tp, typename _Up> 569*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 570*404b540aSrobert fmin(_Tp __x, _Up __y) 571*404b540aSrobert { 572*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 573*404b540aSrobert return fmin(__type(__x), __type(__y)); 574*404b540aSrobert } 575*404b540aSrobert 576*404b540aSrobert using std::fmod; 577*404b540aSrobert using std::frexp; 578*404b540aSrobert 579*404b540aSrobert inline float 580*404b540aSrobert hypot(float __x, float __y) 581*404b540aSrobert { return __builtin_hypotf(__x, __y); } 582*404b540aSrobert 583*404b540aSrobert inline long double 584*404b540aSrobert hypot(long double __x, long double __y) 585*404b540aSrobert { return __builtin_hypotl(__x, __y); } 586*404b540aSrobert 587*404b540aSrobert template<typename _Tp, typename _Up> 588*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 589*404b540aSrobert hypot(_Tp __x, _Up __y) 590*404b540aSrobert { 591*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 592*404b540aSrobert return hypot(__type(__x), __type(__y)); 593*404b540aSrobert } 594*404b540aSrobert 595*404b540aSrobert inline int 596*404b540aSrobert ilogb(float __x) 597*404b540aSrobert { return __builtin_ilogbf(__x); } 598*404b540aSrobert 599*404b540aSrobert inline int 600*404b540aSrobert ilogb(long double __x) 601*404b540aSrobert { return __builtin_ilogbl(__x); } 602*404b540aSrobert 603*404b540aSrobert template<typename _Tp> 604*404b540aSrobert inline int 605*404b540aSrobert ilogb(_Tp __x) 606*404b540aSrobert { 607*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 608*404b540aSrobert return ilogb(__type(__x)); 609*404b540aSrobert } 610*404b540aSrobert 611*404b540aSrobert using std::ldexp; 612*404b540aSrobert 613*404b540aSrobert inline float 614*404b540aSrobert lgamma(float __x) 615*404b540aSrobert { return __builtin_lgammaf(__x); } 616*404b540aSrobert 617*404b540aSrobert inline long double 618*404b540aSrobert lgamma(long double __x) 619*404b540aSrobert { return __builtin_lgammal(__x); } 620*404b540aSrobert 621*404b540aSrobert template<typename _Tp> 622*404b540aSrobert inline typename __promote<_Tp>::__type 623*404b540aSrobert lgamma(_Tp __x) 624*404b540aSrobert { 625*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 626*404b540aSrobert return lgamma(__type(__x)); 627*404b540aSrobert } 628*404b540aSrobert 629*404b540aSrobert inline long long 630*404b540aSrobert llrint(float __x) 631*404b540aSrobert { return __builtin_llrintf(__x); } 632*404b540aSrobert 633*404b540aSrobert inline long long 634*404b540aSrobert llrint(long double __x) 635*404b540aSrobert { return __builtin_llrintl(__x); } 636*404b540aSrobert 637*404b540aSrobert template<typename _Tp> 638*404b540aSrobert inline long long 639*404b540aSrobert llrint(_Tp __x) 640*404b540aSrobert { 641*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 642*404b540aSrobert return llrint(__type(__x)); 643*404b540aSrobert } 644*404b540aSrobert 645*404b540aSrobert inline long long 646*404b540aSrobert llround(float __x) 647*404b540aSrobert { return __builtin_llroundf(__x); } 648*404b540aSrobert 649*404b540aSrobert inline long long 650*404b540aSrobert llround(long double __x) 651*404b540aSrobert { return __builtin_llroundl(__x); } 652*404b540aSrobert 653*404b540aSrobert template<typename _Tp> 654*404b540aSrobert inline long long 655*404b540aSrobert llround(_Tp __x) 656*404b540aSrobert { 657*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 658*404b540aSrobert return llround(__type(__x)); 659*404b540aSrobert } 660*404b540aSrobert 661*404b540aSrobert using std::log; 662*404b540aSrobert using std::log10; 663*404b540aSrobert 664*404b540aSrobert inline float 665*404b540aSrobert log1p(float __x) 666*404b540aSrobert { return __builtin_log1pf(__x); } 667*404b540aSrobert 668*404b540aSrobert inline long double 669*404b540aSrobert log1p(long double __x) 670*404b540aSrobert { return __builtin_log1pl(__x); } 671*404b540aSrobert 672*404b540aSrobert template<typename _Tp> 673*404b540aSrobert inline typename __promote<_Tp>::__type 674*404b540aSrobert log1p(_Tp __x) 675*404b540aSrobert { 676*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 677*404b540aSrobert return log1p(__type(__x)); 678*404b540aSrobert } 679*404b540aSrobert 680*404b540aSrobert // DR 568. 681*404b540aSrobert inline float 682*404b540aSrobert log2(float __x) 683*404b540aSrobert { return __builtin_log2f(__x); } 684*404b540aSrobert 685*404b540aSrobert inline long double 686*404b540aSrobert log2(long double __x) 687*404b540aSrobert { return __builtin_log2l(__x); } 688*404b540aSrobert 689*404b540aSrobert template<typename _Tp> 690*404b540aSrobert inline typename __promote<_Tp>::__type 691*404b540aSrobert log2(_Tp __x) 692*404b540aSrobert { 693*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 694*404b540aSrobert return log2(__type(__x)); 695*404b540aSrobert } 696*404b540aSrobert 697*404b540aSrobert inline float 698*404b540aSrobert logb(float __x) 699*404b540aSrobert { return __builtin_logbf(__x); } 700*404b540aSrobert 701*404b540aSrobert inline long double 702*404b540aSrobert logb(long double __x) 703*404b540aSrobert { return __builtin_logbl(__x); } 704*404b540aSrobert 705*404b540aSrobert template<typename _Tp> 706*404b540aSrobert inline typename __promote<_Tp>::__type 707*404b540aSrobert logb(_Tp __x) 708*404b540aSrobert { 709*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 710*404b540aSrobert return logb(__type(__x)); 711*404b540aSrobert } 712*404b540aSrobert 713*404b540aSrobert inline long 714*404b540aSrobert lrint(float __x) 715*404b540aSrobert { return __builtin_lrintf(__x); } 716*404b540aSrobert 717*404b540aSrobert inline long 718*404b540aSrobert lrint(long double __x) 719*404b540aSrobert { return __builtin_lrintl(__x); } 720*404b540aSrobert 721*404b540aSrobert template<typename _Tp> 722*404b540aSrobert inline long 723*404b540aSrobert lrint(_Tp __x) 724*404b540aSrobert { 725*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 726*404b540aSrobert return lrint(__type(__x)); 727*404b540aSrobert } 728*404b540aSrobert 729*404b540aSrobert inline long 730*404b540aSrobert lround(float __x) 731*404b540aSrobert { return __builtin_lroundf(__x); } 732*404b540aSrobert 733*404b540aSrobert inline long 734*404b540aSrobert lround(long double __x) 735*404b540aSrobert { return __builtin_lroundl(__x); } 736*404b540aSrobert 737*404b540aSrobert template<typename _Tp> 738*404b540aSrobert inline long 739*404b540aSrobert lround(_Tp __x) 740*404b540aSrobert { 741*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 742*404b540aSrobert return lround(__type(__x)); 743*404b540aSrobert } 744*404b540aSrobert 745*404b540aSrobert inline float 746*404b540aSrobert nearbyint(float __x) 747*404b540aSrobert { return __builtin_nearbyintf(__x); } 748*404b540aSrobert 749*404b540aSrobert inline long double 750*404b540aSrobert nearbyint(long double __x) 751*404b540aSrobert { return __builtin_nearbyintl(__x); } 752*404b540aSrobert 753*404b540aSrobert template<typename _Tp> 754*404b540aSrobert inline typename __promote<_Tp>::__type 755*404b540aSrobert nearbyint(_Tp __x) 756*404b540aSrobert { 757*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 758*404b540aSrobert return nearbyint(__type(__x)); 759*404b540aSrobert } 760*404b540aSrobert 761*404b540aSrobert inline float 762*404b540aSrobert nextafter(float __x, float __y) 763*404b540aSrobert { return __builtin_nextafterf(__x, __y); } 764*404b540aSrobert 765*404b540aSrobert inline long double 766*404b540aSrobert nextafter(long double __x, long double __y) 767*404b540aSrobert { return __builtin_nextafterl(__x, __y); } 768*404b540aSrobert 769*404b540aSrobert template<typename _Tp, typename _Up> 770*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 771*404b540aSrobert nextafter(_Tp __x, _Up __y) 772*404b540aSrobert { 773*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 774*404b540aSrobert return nextafter(__type(__x), __type(__y)); 775*404b540aSrobert } 776*404b540aSrobert 777*404b540aSrobert inline float 778*404b540aSrobert nexttoward(float __x, long double __y) 779*404b540aSrobert { return __builtin_nexttowardf(__x, __y); } 780*404b540aSrobert 781*404b540aSrobert inline long double 782*404b540aSrobert nexttoward(long double __x, long double __y) 783*404b540aSrobert { return __builtin_nexttowardl(__x, __y); } 784*404b540aSrobert 785*404b540aSrobert template<typename _Tp> 786*404b540aSrobert inline typename __promote<_Tp>::__type 787*404b540aSrobert nexttoward(_Tp __x, long double __y) 788*404b540aSrobert { 789*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 790*404b540aSrobert return nexttoward(__type(__x), __y); 791*404b540aSrobert } 792*404b540aSrobert 793*404b540aSrobert using std::pow; 794*404b540aSrobert 795*404b540aSrobert // DR 550. 796*404b540aSrobert template<typename _Tp, typename _Up> 797*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 798*404b540aSrobert pow(_Tp __x, _Up __y) 799*404b540aSrobert { 800*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 801*404b540aSrobert return pow(__type(__x), __type(__y)); 802*404b540aSrobert } 803*404b540aSrobert 804*404b540aSrobert inline float 805*404b540aSrobert remainder(float __x, float __y) 806*404b540aSrobert { return __builtin_remainderf(__x, __y); } 807*404b540aSrobert 808*404b540aSrobert inline long double 809*404b540aSrobert remainder(long double __x, long double __y) 810*404b540aSrobert { return __builtin_remainderl(__x, __y); } 811*404b540aSrobert 812*404b540aSrobert template<typename _Tp, typename _Up> 813*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 814*404b540aSrobert remainder(_Tp __x, _Up __y) 815*404b540aSrobert { 816*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 817*404b540aSrobert return remainder(__type(__x), __type(__y)); 818*404b540aSrobert } 819*404b540aSrobert 820*404b540aSrobert inline float 821*404b540aSrobert remquo(float __x, float __y, int* __pquo) 822*404b540aSrobert { return __builtin_remquof(__x, __y, __pquo); } 823*404b540aSrobert 824*404b540aSrobert inline long double 825*404b540aSrobert remquo(long double __x, long double __y, int* __pquo) 826*404b540aSrobert { return __builtin_remquol(__x, __y, __pquo); } 827*404b540aSrobert 828*404b540aSrobert template<typename _Tp, typename _Up> 829*404b540aSrobert inline typename __promote_2<_Tp, _Up>::__type 830*404b540aSrobert remquo(_Tp __x, _Up __y, int* __pquo) 831*404b540aSrobert { 832*404b540aSrobert typedef typename __promote_2<_Tp, _Up>::__type __type; 833*404b540aSrobert return remquo(__type(__x), __type(__y), __pquo); 834*404b540aSrobert } 835*404b540aSrobert 836*404b540aSrobert inline float 837*404b540aSrobert rint(float __x) 838*404b540aSrobert { return __builtin_rintf(__x); } 839*404b540aSrobert 840*404b540aSrobert inline long double 841*404b540aSrobert rint(long double __x) 842*404b540aSrobert { return __builtin_rintl(__x); } 843*404b540aSrobert 844*404b540aSrobert template<typename _Tp> 845*404b540aSrobert inline typename __promote<_Tp>::__type 846*404b540aSrobert rint(_Tp __x) 847*404b540aSrobert { 848*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 849*404b540aSrobert return rint(__type(__x)); 850*404b540aSrobert } 851*404b540aSrobert 852*404b540aSrobert inline float 853*404b540aSrobert round(float __x) 854*404b540aSrobert { return __builtin_roundf(__x); } 855*404b540aSrobert 856*404b540aSrobert inline long double 857*404b540aSrobert round(long double __x) 858*404b540aSrobert { return __builtin_roundl(__x); } 859*404b540aSrobert 860*404b540aSrobert template<typename _Tp> 861*404b540aSrobert inline typename __promote<_Tp>::__type 862*404b540aSrobert round(_Tp __x) 863*404b540aSrobert { 864*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 865*404b540aSrobert return round(__type(__x)); 866*404b540aSrobert } 867*404b540aSrobert 868*404b540aSrobert inline float 869*404b540aSrobert scalbln(float __x, long __ex) 870*404b540aSrobert { return __builtin_scalblnf(__x, __ex); } 871*404b540aSrobert 872*404b540aSrobert inline long double 873*404b540aSrobert scalbln(long double __x, long __ex) 874*404b540aSrobert { return __builtin_scalblnl(__x, __ex); } 875*404b540aSrobert 876*404b540aSrobert template<typename _Tp> 877*404b540aSrobert inline typename __promote<_Tp>::__type 878*404b540aSrobert scalbln(_Tp __x, long __ex) 879*404b540aSrobert { 880*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 881*404b540aSrobert return scalbln(__type(__x), __ex); 882*404b540aSrobert } 883*404b540aSrobert 884*404b540aSrobert inline float 885*404b540aSrobert scalbn(float __x, int __ex) 886*404b540aSrobert { return __builtin_scalbnf(__x, __ex); } 887*404b540aSrobert 888*404b540aSrobert inline long double 889*404b540aSrobert scalbn(long double __x, int __ex) 890*404b540aSrobert { return __builtin_scalbnl(__x, __ex); } 891*404b540aSrobert 892*404b540aSrobert template<typename _Tp> 893*404b540aSrobert inline typename __promote<_Tp>::__type 894*404b540aSrobert scalbn(_Tp __x, int __ex) 895*404b540aSrobert { 896*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 897*404b540aSrobert return scalbn(__type(__x), __ex); 898*404b540aSrobert } 899*404b540aSrobert 900*404b540aSrobert using std::sin; 901*404b540aSrobert using std::sinh; 902*404b540aSrobert using std::sqrt; 903*404b540aSrobert using std::tan; 904*404b540aSrobert using std::tanh; 905*404b540aSrobert 906*404b540aSrobert inline float 907*404b540aSrobert tgamma(float __x) 908*404b540aSrobert { return __builtin_tgammaf(__x); } 909*404b540aSrobert 910*404b540aSrobert inline long double 911*404b540aSrobert tgamma(long double __x) 912*404b540aSrobert { return __builtin_tgammal(__x); } 913*404b540aSrobert 914*404b540aSrobert template<typename _Tp> 915*404b540aSrobert inline typename __promote<_Tp>::__type 916*404b540aSrobert tgamma(_Tp __x) 917*404b540aSrobert { 918*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 919*404b540aSrobert return tgamma(__type(__x)); 920*404b540aSrobert } 921*404b540aSrobert 922*404b540aSrobert inline float 923*404b540aSrobert trunc(float __x) 924*404b540aSrobert { return __builtin_truncf(__x); } 925*404b540aSrobert 926*404b540aSrobert inline long double 927*404b540aSrobert trunc(long double __x) 928*404b540aSrobert { return __builtin_truncl(__x); } 929*404b540aSrobert 930*404b540aSrobert template<typename _Tp> 931*404b540aSrobert inline typename __promote<_Tp>::__type 932*404b540aSrobert trunc(_Tp __x) 933*404b540aSrobert { 934*404b540aSrobert typedef typename __promote<_Tp>::__type __type; 935*404b540aSrobert return trunc(__type(__x)); 936*404b540aSrobert } 937*404b540aSrobert 938*404b540aSrobert#endif 939*404b540aSrobert 940*404b540aSrobert_GLIBCXX_END_NAMESPACE 941*404b540aSrobert} 942*404b540aSrobert 943*404b540aSrobert#endif 944