libstdc++
math.h
Go to the documentation of this file.
1 // -*- C++ -*- compatibility header.
2 
3 // Copyright (C) 2002-2020 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 /** @file math.h
26  * This is a Standard C++ Library header.
27  */
28 
29 #if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
30 # include_next <math.h>
31 #else
32 
33 #ifndef _GLIBCXX_MATH_H
34 #define _GLIBCXX_MATH_H 1
35 
36 # include <cmath>
37 
38 using std::abs;
39 using std::acos;
40 using std::asin;
41 using std::atan;
42 using std::atan2;
43 using std::cos;
44 using std::sin;
45 using std::tan;
46 using std::cosh;
47 using std::sinh;
48 using std::tanh;
49 using std::exp;
50 using std::frexp;
51 using std::ldexp;
52 using std::log;
53 using std::log10;
54 using std::modf;
55 using std::pow;
56 using std::sqrt;
57 using std::ceil;
58 using std::fabs;
59 using std::floor;
60 using std::fmod;
61 
62 #if _GLIBCXX_USE_C99_MATH
63 using std::fpclassify;
64 using std::isfinite;
65 using std::isinf;
66 using std::isnan;
67 using std::isnormal;
68 using std::signbit;
69 using std::isgreater;
70 using std::isgreaterequal;
71 using std::isless;
72 using std::islessequal;
73 using std::islessgreater;
74 using std::isunordered;
75 #endif
76 
77 #if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_TR1)
78 using std::acosh;
79 using std::asinh;
80 using std::atanh;
81 using std::cbrt;
82 using std::copysign;
83 using std::erf;
84 using std::erfc;
85 using std::exp2;
86 using std::expm1;
87 using std::fdim;
88 using std::fma;
89 using std::fmax;
90 using std::fmin;
91 using std::hypot;
92 using std::ilogb;
93 using std::lgamma;
94 using std::llrint;
95 using std::llround;
96 using std::log1p;
97 using std::log2;
98 using std::logb;
99 using std::lrint;
100 using std::lround;
101 using std::nearbyint;
102 using std::nextafter;
103 using std::nexttoward;
104 using std::remainder;
105 using std::remquo;
106 using std::rint;
107 using std::round;
108 using std::scalbln;
109 using std::scalbn;
110 using std::tgamma;
111 using std::trunc;
112 #endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1
113 
114 // The mathematical special functions are only added to the global namespace
115 // by IS 29124, but not by C++17.
116 #if __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
119 using std::assoc_laguerre;
122 using std::assoc_legendre;
123 using std::betaf;
124 using std::betal;
125 using std::beta;
126 using std::comp_ellint_1f;
127 using std::comp_ellint_1l;
128 using std::comp_ellint_1;
129 using std::comp_ellint_2f;
130 using std::comp_ellint_2l;
131 using std::comp_ellint_2;
132 using std::comp_ellint_3f;
133 using std::comp_ellint_3l;
134 using std::comp_ellint_3;
135 using std::cyl_bessel_if;
136 using std::cyl_bessel_il;
137 using std::cyl_bessel_i;
138 using std::cyl_bessel_jf;
139 using std::cyl_bessel_jl;
140 using std::cyl_bessel_j;
141 using std::cyl_bessel_kf;
142 using std::cyl_bessel_kl;
143 using std::cyl_bessel_k;
144 using std::cyl_neumannf;
145 using std::cyl_neumannl;
146 using std::cyl_neumann;
147 using std::ellint_1f;
148 using std::ellint_1l;
149 using std::ellint_1;
150 using std::ellint_2f;
151 using std::ellint_2l;
152 using std::ellint_2;
153 using std::ellint_3f;
154 using std::ellint_3l;
155 using std::ellint_3;
156 using std::expintf;
157 using std::expintl;
158 using std::expint;
159 using std::hermitef;
160 using std::hermitel;
161 using std::hermite;
162 using std::laguerref;
163 using std::laguerrel;
164 using std::laguerre;
165 using std::legendref;
166 using std::legendrel;
167 using std::legendre;
168 using std::riemann_zetaf;
169 using std::riemann_zetal;
170 using std::riemann_zeta;
171 using std::sph_besself;
172 using std::sph_bessell;
173 using std::sph_bessel;
174 using std::sph_legendref;
175 using std::sph_legendrel;
176 using std::sph_legendre;
177 using std::sph_neumannf;
178 using std::sph_neumannl;
179 using std::sph_neumann;
180 #endif // _GLIBCXX_USE_STD_SPEC_FUNCS
181 
182 #if __cplusplus > 201703L
183 using std::lerp;
184 #endif // C++20
185 
186 #endif // _GLIBCXX_MATH_H
187 #endif // __cplusplus
complex< _Tp > log10(const complex< _Tp > &)
Return complex base 10 logarithm of z.
Definition: complex:828
complex< _Tp > sin(const complex< _Tp > &)
Return complex sine of z.
Definition: complex:858
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
Definition: complex:823
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
Definition: complex:959
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
Definition: complex:629
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
Definition: complex:796
complex< _Tp > cosh(const complex< _Tp > &)
Return complex hyperbolic cosine of z.
Definition: complex:770
complex< _Tp > tanh(const complex< _Tp > &)
Return complex hyperbolic tangent of z.
Definition: complex:987
complex< _Tp > pow(const complex< _Tp > &, int)
Return x to the y'th power.
Definition: complex:1018
complex< _Tp > sinh(const complex< _Tp > &)
Return complex hyperbolic sine of z.
Definition: complex:888
complex< _Tp > cos(const complex< _Tp > &)
Return complex cosine of z.
Definition: complex:740
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
Definition: complex:932
long double sph_bessell(unsigned int __n, long double __x)
Definition: specfun.h:1083
float betaf(float __a, float __b)
Definition: specfun.h:312
long double expintl(long double __x)
Definition: specfun.h:854
float cyl_bessel_jf(float __nu, float __x)
Definition: specfun.h:550
float ellint_3f(float __k, float __nu, float __phi)
Return the incomplete elliptic integral of the third kind for float argument.
Definition: specfun.h:792
long double legendrel(unsigned int __l, long double __x)
Definition: specfun.h:987
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_i(_Tpnu __nu, _Tp __x)
Definition: specfun.h:535
long double comp_ellint_3l(long double __k, long double __nu)
Return the complete elliptic integral of the third kind for long double modulus k.
Definition: specfun.h:463
__gnu_cxx::__promote< _Tp >::__type sph_neumann(unsigned int __n, _Tp __x)
Definition: specfun.h:1193
long double riemann_zetal(long double __s)
Definition: specfun.h:1032
float cyl_bessel_kf(float __nu, float __x)
Definition: specfun.h:596
__gnu_cxx::__promote_3< _Tp, _Tpn, _Tpp >::__type ellint_3(_Tp __k, _Tpn __nu, _Tpp __phi)
Return the incomplete elliptic integral of the third kind .
Definition: specfun.h:830
float comp_ellint_2f(float __k)
Definition: specfun.h:406
long double hermitel(unsigned int __n, long double __x)
Definition: specfun.h:895
__gnu_cxx::__promote< _Tp >::__type comp_ellint_2(_Tp __k)
Definition: specfun.h:438
long double sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
Definition: specfun.h:1128
float ellint_1f(float __k, float __phi)
Definition: specfun.h:696
__gnu_cxx::__promote< _Tp >::__type assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
Definition: specfun.h:298
__gnu_cxx::__promote< _Tp >::__type assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
Definition: specfun.h:252
float assoc_legendref(unsigned int __l, unsigned int __m, float __x)
Definition: specfun.h:267
long double sph_neumannl(unsigned int __n, long double __x)
Definition: specfun.h:1174
__gnu_cxx::__promote< _Tp >::__type sph_bessel(unsigned int __n, _Tp __x)
Definition: specfun.h:1102
long double comp_ellint_2l(long double __k)
Definition: specfun.h:416
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_j(_Tpnu __nu, _Tp __x)
Definition: specfun.h:581
float sph_besself(unsigned int __n, float __x)
Definition: specfun.h:1073
long double assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
Definition: specfun.h:276
__gnu_cxx::__promote< _Tp >::__type sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
Definition: specfun.h:1149
float expintf(float __x)
Definition: specfun.h:844
float ellint_2f(float __k, float __phi)
Return the incomplete elliptic integral of the second kind for float argument.
Definition: specfun.h:744
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_neumann(_Tpnu __nu, _Tp __x)
Definition: specfun.h:681
long double ellint_2l(long double __k, long double __phi)
Return the incomplete elliptic integral of the second kind .
Definition: specfun.h:754
float cyl_neumannf(float __nu, float __x)
Definition: specfun.h:648
__gnu_cxx::__promote< _Tp >::__type riemann_zeta(_Tp __s)
Definition: specfun.h:1058
__gnu_cxx::__promote_2< _Tpa, _Tpb >::__type beta(_Tpa __a, _Tpb __b)
Definition: specfun.h:343
long double comp_ellint_1l(long double __k)
Definition: specfun.h:368
float comp_ellint_3f(float __k, float __nu)
Return the complete elliptic integral of the third kind for float modulus k.
Definition: specfun.h:453
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_k(_Tpnu __nu, _Tp __x)
Definition: specfun.h:633
float sph_neumannf(unsigned int __n, float __x)
Definition: specfun.h:1164
long double ellint_1l(long double __k, long double __phi)
Definition: specfun.h:706
float comp_ellint_1f(float __k)
Definition: specfun.h:358
__gnu_cxx::__promote< _Tp >::__type expint(_Tp __x)
Definition: specfun.h:870
long double betal(long double __a, long double __b)
Definition: specfun.h:322
float hermitef(unsigned int __n, float __x)
Definition: specfun.h:885
__gnu_cxx::__promote< _Tp >::__type hermite(unsigned int __n, _Tp __x)
Definition: specfun.h:918
long double ellint_3l(long double __k, long double __nu, long double __phi)
Return the incomplete elliptic integral of the third kind .
Definition: specfun.h:802
float sph_legendref(unsigned int __l, unsigned int __m, float __theta)
Definition: specfun.h:1117
float cyl_bessel_if(float __nu, float __x)
Definition: specfun.h:504
long double laguerrel(unsigned int __n, long double __x)
Definition: specfun.h:943
long double cyl_bessel_il(long double __nu, long double __x)
Definition: specfun.h:514
long double cyl_bessel_kl(long double __nu, long double __x)
Definition: specfun.h:606
__gnu_cxx::__promote< _Tp >::__type comp_ellint_1(_Tp __k)
Definition: specfun.h:391
long double assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
Definition: specfun.h:216
__gnu_cxx::__promote< _Tp >::__type laguerre(unsigned int __n, _Tp __x)
Definition: specfun.h:962
__gnu_cxx::__promote_2< _Tp, _Tpp >::__type ellint_2(_Tp __k, _Tpp __phi)
Definition: specfun.h:777
__gnu_cxx::__promote_2< _Tp, _Tpn >::__type comp_ellint_3(_Tp __k, _Tpn __nu)
Definition: specfun.h:489
float laguerref(unsigned int __n, float __x)
Definition: specfun.h:933
long double cyl_bessel_jl(long double __nu, long double __x)
Definition: specfun.h:560
__gnu_cxx::__promote_2< _Tp, _Tpp >::__type ellint_1(_Tp __k, _Tpp __phi)
Definition: specfun.h:729
float legendref(unsigned int __l, float __x)
Definition: specfun.h:977
__gnu_cxx::__promote< _Tp >::__type legendre(unsigned int __l, _Tp __x)
Definition: specfun.h:1007
float assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
Definition: specfun.h:206
long double cyl_neumannl(long double __nu, long double __x)
Definition: specfun.h:658
float riemann_zetaf(float __s)
Definition: specfun.h:1022
_Tp fabs(const std::complex< _Tp > &)
fabs(__z) [8.1.8].
Definition: complex:1842
std::complex< _Tp > asinh(const std::complex< _Tp > &)
asinh(__z) [8.1.6].
Definition: complex:1789
std::complex< _Tp > atan(const std::complex< _Tp > &)
atan(__z) [8.1.4].
Definition: complex:1714
std::complex< _Tp > atanh(const std::complex< _Tp > &)
atanh(__z) [8.1.7].
Definition: complex:1833
std::complex< _Tp > acosh(const std::complex< _Tp > &)
acosh(__z) [8.1.5].
Definition: complex:1750
std::complex< _Tp > acos(const std::complex< _Tp > &)
acos(__z) [8.1.2].
Definition: complex:1634
std::complex< _Tp > asin(const std::complex< _Tp > &)
asin(__z) [8.1.3].
Definition: complex:1670