// -*- C++ -*- C forwarding header.// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,// 2006, 2007, 2008, 2009// Free Software Foundation, Inc.//// This file is part of the GNU ISO C++ Library. This library is free// software; you can redistribute it and/or modify it under the// terms of the GNU General Public License as published by the// Free Software Foundation; either version 3, or (at your option)// any later version.// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.// Under Section 7 of GPL version 3, you are granted additional// permissions described in the GCC Runtime Library Exception, version// 3.1, as published by the Free Software Foundation.// You should have received a copy of the GNU General Public License and// a copy of the GCC Runtime Library Exception along with this program;// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see// <http://www.gnu.org/licenses/>./** @file include/cmath* This is a Standard C++ Library file. You should @c #include this file* in your programs, rather than any of the "*.h" implementation files.** This is the C++ version of the Standard C Library header @c math.h,* and its contents are (mostly) the same as that header, but are all* contained in the namespace @c std (except for names which are defined* as macros in C).*///// ISO C++ 14882: 26.5 C library//#ifndef _GLIBCXX_CMATH#define _GLIBCXX_CMATH 1#pragma GCC system_header#include <bits/c++config.h>#include <bits/cpp_type_traits.h>#include <ext/type_traits.h>#include <math.h>// Get rid of those macros defined in <math.h> in lieu of real functions.#undef abs#undef div#undef acos#undef asin#undef atan#undef atan2#undef ceil#undef cos#undef cosh#undef exp#undef fabs#undef floor#undef fmod#undef frexp#undef ldexp#undef log#undef log10#undef modf#undef pow#undef sin#undef sinh#undef sqrt#undef tan#undef tanh_GLIBCXX_BEGIN_NAMESPACE(std)// Forward declaration of a helper function. This really should be// an `exported' forward declaration.template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);inline doubleabs(double __x){ return __builtin_fabs(__x); }inline floatabs(float __x){ return __builtin_fabsf(__x); }inline long doubleabs(long double __x){ return __builtin_fabsl(__x); }using ::acos;inline floatacos(float __x){ return __builtin_acosf(__x); }inline long doubleacos(long double __x){ return __builtin_acosl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeacos(_Tp __x){ return __builtin_acos(__x); }using ::asin;inline floatasin(float __x){ return __builtin_asinf(__x); }inline long doubleasin(long double __x){ return __builtin_asinl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeasin(_Tp __x){ return __builtin_asin(__x); }using ::atan;inline floatatan(float __x){ return __builtin_atanf(__x); }inline long doubleatan(long double __x){ return __builtin_atanl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeatan(_Tp __x){ return __builtin_atan(__x); }using ::atan2;inline floatatan2(float __y, float __x){ return __builtin_atan2f(__y, __x); }inline long doubleatan2(long double __y, long double __x){ return __builtin_atan2l(__y, __x); }template<typename _Tp, typename _Up>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value&& __is_integer<_Up>::__value,double>::__typeatan2(_Tp __y, _Up __x){ return __builtin_atan2(__y, __x); }using ::ceil;inline floatceil(float __x){ return __builtin_ceilf(__x); }inline long doubleceil(long double __x){ return __builtin_ceill(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeceil(_Tp __x){ return __builtin_ceil(__x); }using ::cos;inline floatcos(float __x){ return __builtin_cosf(__x); }inline long doublecos(long double __x){ return __builtin_cosl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typecos(_Tp __x){ return __builtin_cos(__x); }using ::cosh;inline floatcosh(float __x){ return __builtin_coshf(__x); }inline long doublecosh(long double __x){ return __builtin_coshl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typecosh(_Tp __x){ return __builtin_cosh(__x); }using ::exp;inline floatexp(float __x){ return __builtin_expf(__x); }inline long doubleexp(long double __x){ return __builtin_expl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeexp(_Tp __x){ return __builtin_exp(__x); }using ::fabs;inline floatfabs(float __x){ return __builtin_fabsf(__x); }inline long doublefabs(long double __x){ return __builtin_fabsl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typefabs(_Tp __x){ return __builtin_fabs(__x); }using ::floor;inline floatfloor(float __x){ return __builtin_floorf(__x); }inline long doublefloor(long double __x){ return __builtin_floorl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typefloor(_Tp __x){ return __builtin_floor(__x); }using ::fmod;inline floatfmod(float __x, float __y){ return __builtin_fmodf(__x, __y); }inline long doublefmod(long double __x, long double __y){ return __builtin_fmodl(__x, __y); }using ::frexp;inline floatfrexp(float __x, int* __exp){ return __builtin_frexpf(__x, __exp); }inline long doublefrexp(long double __x, int* __exp){ return __builtin_frexpl(__x, __exp); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typefrexp(_Tp __x, int* __exp){ return __builtin_frexp(__x, __exp); }using ::ldexp;inline floatldexp(float __x, int __exp){ return __builtin_ldexpf(__x, __exp); }inline long doubleldexp(long double __x, int __exp){ return __builtin_ldexpl(__x, __exp); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typeldexp(_Tp __x, int __exp){ return __builtin_ldexp(__x, __exp); }using ::log;inline floatlog(float __x){ return __builtin_logf(__x); }inline long doublelog(long double __x){ return __builtin_logl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typelog(_Tp __x){ return __builtin_log(__x); }using ::log10;inline floatlog10(float __x){ return __builtin_log10f(__x); }inline long doublelog10(long double __x){ return __builtin_log10l(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typelog10(_Tp __x){ return __builtin_log10(__x); }using ::modf;inline floatmodf(float __x, float* __iptr){ return __builtin_modff(__x, __iptr); }inline long doublemodf(long double __x, long double* __iptr){ return __builtin_modfl(__x, __iptr); }template<typename _Tp>inline _Tp__pow_helper(_Tp __x, int __n){return __n < 0? _Tp(1)/__cmath_power(__x, -__n): __cmath_power(__x, __n);}using ::pow;inline floatpow(float __x, float __y){ return __builtin_powf(__x, __y); }inline long doublepow(long double __x, long double __y){ return __builtin_powl(__x, __y); }inline doublepow(double __x, int __i){ return __builtin_powi(__x, __i); }inline floatpow(float __x, int __n){ return __builtin_powif(__x, __n); }inline long doublepow(long double __x, int __n){ return __builtin_powil(__x, __n); }using ::sin;inline floatsin(float __x){ return __builtin_sinf(__x); }inline long doublesin(long double __x){ return __builtin_sinl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typesin(_Tp __x){ return __builtin_sin(__x); }using ::sinh;inline floatsinh(float __x){ return __builtin_sinhf(__x); }inline long doublesinh(long double __x){ return __builtin_sinhl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typesinh(_Tp __x){ return __builtin_sinh(__x); }using ::sqrt;inline floatsqrt(float __x){ return __builtin_sqrtf(__x); }inline long doublesqrt(long double __x){ return __builtin_sqrtl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typesqrt(_Tp __x){ return __builtin_sqrt(__x); }using ::tan;inline floattan(float __x){ return __builtin_tanf(__x); }inline long doubletan(long double __x){ return __builtin_tanl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typetan(_Tp __x){ return __builtin_tan(__x); }using ::tanh;inline floattanh(float __x){ return __builtin_tanhf(__x); }inline long doubletanh(long double __x){ return __builtin_tanhl(__x); }template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,double>::__typetanh(_Tp __x){ return __builtin_tanh(__x); }_GLIBCXX_END_NAMESPACE#if _GLIBCXX_USE_C99_MATH#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC// These are possible macros imported from C99-land.#undef fpclassify#undef isfinite#undef isinf#undef isnan#undef isnormal#undef signbit#undef isgreater#undef isgreaterequal#undef isless#undef islessequal#undef islessgreater#undef isunordered_GLIBCXX_BEGIN_NAMESPACE(std)template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typefpclassify(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,FP_SUBNORMAL, FP_ZERO, __type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisfinite(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isfinite(__type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisinf(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isinf(__type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisnan(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isnan(__type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisnormal(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isnormal(__type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typesignbit(_Tp __f){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_signbit(__type(__f));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisgreater(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isgreater(__type(__f1), __type(__f2));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisgreaterequal(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isgreaterequal(__type(__f1), __type(__f2));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisless(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isless(__type(__f1), __type(__f2));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeislessequal(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_islessequal(__type(__f1), __type(__f2));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeislessgreater(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_islessgreater(__type(__f1), __type(__f2));}template<typename _Tp>inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,int>::__typeisunordered(_Tp __f1, _Tp __f2){typedef typename __gnu_cxx::__promote<_Tp>::__type __type;return __builtin_isunordered(__type(__f1), __type(__f2));}_GLIBCXX_END_NAMESPACE#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */#endif#ifndef _GLIBCXX_EXPORT_TEMPLATE# include <bits/cmath.tcc>#endif#endif