libstdc++
math.h
Go to the documentation of this file.
1// -*- C++ -*- compatibility header.
2
3// Copyright (C) 2002-2022 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
38using std::abs;
39using std::acos;
40using std::asin;
41using std::atan;
42using std::atan2;
43using std::cos;
44using std::sin;
45using std::tan;
46using std::cosh;
47using std::sinh;
48using std::tanh;
49using std::exp;
50using std::frexp;
51using std::ldexp;
52using std::log;
53using std::log10;
54using std::modf;
55using std::pow;
56using std::sqrt;
57using std::ceil;
58using std::fabs;
59using std::floor;
60using std::fmod;
61
62#if _GLIBCXX_USE_C99_MATH
63using std::fpclassify;
64using std::isfinite;
65using std::isinf;
66using std::isnan;
67using std::isnormal;
68using std::signbit;
69using std::isgreater;
70using std::isgreaterequal;
71using std::isless;
72using std::islessequal;
73using std::islessgreater;
74using std::isunordered;
75#endif
76
77#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_TR1)
78using std::acosh;
79using std::asinh;
80using std::atanh;
81using std::cbrt;
82using std::copysign;
83using std::erf;
84using std::erfc;
85using std::exp2;
86using std::expm1;
87using std::fdim;
88using std::fma;
89using std::fmax;
90using std::fmin;
91using std::hypot;
92using std::ilogb;
93using std::lgamma;
94using std::llrint;
95using std::llround;
96using std::log1p;
97using std::log2;
98using std::logb;
99using std::lrint;
100using std::lround;
101using std::nearbyint;
102using std::nextafter;
103using std::nexttoward;
104using std::remainder;
105using std::remquo;
106using std::rint;
107using std::round;
108using std::scalbln;
109using std::scalbn;
110using std::tgamma;
111using 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
123using std::betaf;
124using std::betal;
125using std::beta;
146using std::cyl_neumann;
147using std::ellint_1f;
148using std::ellint_1l;
149using std::ellint_1;
150using std::ellint_2f;
151using std::ellint_2l;
152using std::ellint_2;
153using std::ellint_3f;
154using std::ellint_3l;
155using std::ellint_3;
156using std::expintf;
157using std::expintl;
158using std::expint;
159using std::hermitef;
160using std::hermitel;
161using std::hermite;
162using std::laguerref;
163using std::laguerrel;
164using std::laguerre;
165using std::legendref;
166using std::legendrel;
167using std::legendre;
171using std::sph_besself;
172using std::sph_bessell;
173using std::sph_bessel;
179using std::sph_neumann;
180#endif // _GLIBCXX_USE_STD_SPEC_FUNCS
181
182#if __cplusplus > 201703L
183using 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:829
complex< _Tp > sin(const complex< _Tp > &)
Return complex sine of z.
Definition: complex:859
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
Definition: complex:824
complex< _Tp > tan(const complex< _Tp > &)
Return complex tangent of z.
Definition: complex:960
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
Definition: complex:630
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.
Definition: complex:797
complex< _Tp > cosh(const complex< _Tp > &)
Return complex hyperbolic cosine of z.
Definition: complex:771
complex< _Tp > tanh(const complex< _Tp > &)
Return complex hyperbolic tangent of z.
Definition: complex:988
complex< _Tp > pow(const complex< _Tp > &, int)
Return x to the y'th power.
Definition: complex:1019
complex< _Tp > sinh(const complex< _Tp > &)
Return complex hyperbolic sine of z.
Definition: complex:889
complex< _Tp > cos(const complex< _Tp > &)
Return complex cosine of z.
Definition: complex:741
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
Definition: complex:933
__gnu_cxx::__promote< _Tp >::__type sph_bessel(unsigned int __n, _Tp __x)
Definition: specfun.h:1100
long double sph_bessell(unsigned int __n, long double __x)
Definition: specfun.h:1081
float betaf(float __a, float __b)
Definition: specfun.h:310
long double expintl(long double __x)
Definition: specfun.h:852
float cyl_bessel_jf(float __nu, float __x)
Definition: specfun.h:548
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_k(_Tpnu __nu, _Tp __x)
Definition: specfun.h:631
float ellint_3f(float __k, float __nu, float __phi)
Return the incomplete elliptic integral of the third kind for float argument.
Definition: specfun.h:790
long double legendrel(unsigned int __l, long double __x)
Definition: specfun.h:985
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:461
long double riemann_zetal(long double __s)
Definition: specfun.h:1030
float cyl_bessel_kf(float __nu, float __x)
Definition: specfun.h:594
float comp_ellint_2f(float __k)
Definition: specfun.h:404
long double hermitel(unsigned int __n, long double __x)
Definition: specfun.h:893
__gnu_cxx::__promote_2< _Tp, _Tpp >::__type ellint_1(_Tp __k, _Tpp __phi)
Definition: specfun.h:727
long double sph_legendrel(unsigned int __l, unsigned int __m, long double __theta)
Definition: specfun.h:1126
float ellint_1f(float __k, float __phi)
Definition: specfun.h:694
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_neumann(_Tpnu __nu, _Tp __x)
Definition: specfun.h:679
float assoc_legendref(unsigned int __l, unsigned int __m, float __x)
Definition: specfun.h:265
long double sph_neumannl(unsigned int __n, long double __x)
Definition: specfun.h:1172
long double comp_ellint_2l(long double __k)
Definition: specfun.h:414
__gnu_cxx::__promote< _Tp >::__type comp_ellint_2(_Tp __k)
Definition: specfun.h:436
float sph_besself(unsigned int __n, float __x)
Definition: specfun.h:1071
long double assoc_legendrel(unsigned int __l, unsigned int __m, long double __x)
Definition: specfun.h:274
__gnu_cxx::__promote< _Tp >::__type legendre(unsigned int __l, _Tp __x)
Definition: specfun.h:1005
float expintf(float __x)
Definition: specfun.h:842
float ellint_2f(float __k, float __phi)
Return the incomplete elliptic integral of the second kind for float argument.
Definition: specfun.h:742
__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:828
long double ellint_2l(long double __k, long double __phi)
Return the incomplete elliptic integral of the second kind .
Definition: specfun.h:752
float cyl_neumannf(float __nu, float __x)
Definition: specfun.h:646
__gnu_cxx::__promote_2< _Tpa, _Tpb >::__type beta(_Tpa __a, _Tpb __b)
Definition: specfun.h:341
long double comp_ellint_1l(long double __k)
Definition: specfun.h:366
float comp_ellint_3f(float __k, float __nu)
Return the complete elliptic integral of the third kind for float modulus k.
Definition: specfun.h:451
float sph_neumannf(unsigned int __n, float __x)
Definition: specfun.h:1162
__gnu_cxx::__promote< _Tp >::__type expint(_Tp __x)
Definition: specfun.h:868
long double ellint_1l(long double __k, long double __phi)
Definition: specfun.h:704
float comp_ellint_1f(float __k)
Definition: specfun.h:356
long double betal(long double __a, long double __b)
Definition: specfun.h:320
float hermitef(unsigned int __n, float __x)
Definition: specfun.h:883
__gnu_cxx::__promote< _Tp >::__type riemann_zeta(_Tp __s)
Definition: specfun.h:1056
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:800
float sph_legendref(unsigned int __l, unsigned int __m, float __theta)
Definition: specfun.h:1115
__gnu_cxx::__promote< _Tp >::__type sph_neumann(unsigned int __n, _Tp __x)
Definition: specfun.h:1191
float cyl_bessel_if(float __nu, float __x)
Definition: specfun.h:502
long double laguerrel(unsigned int __n, long double __x)
Definition: specfun.h:941
long double cyl_bessel_il(long double __nu, long double __x)
Definition: specfun.h:512
__gnu_cxx::__promote< _Tp >::__type assoc_laguerre(unsigned int __n, unsigned int __m, _Tp __x)
Definition: specfun.h:250
__gnu_cxx::__promote_2< _Tp, _Tpn >::__type comp_ellint_3(_Tp __k, _Tpn __nu)
Definition: specfun.h:487
__gnu_cxx::__promote< _Tp >::__type sph_legendre(unsigned int __l, unsigned int __m, _Tp __theta)
Definition: specfun.h:1147
long double cyl_bessel_kl(long double __nu, long double __x)
Definition: specfun.h:604
long double assoc_laguerrel(unsigned int __n, unsigned int __m, long double __x)
Definition: specfun.h:214
__gnu_cxx::__promote< _Tp >::__type hermite(unsigned int __n, _Tp __x)
Definition: specfun.h:916
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_j(_Tpnu __nu, _Tp __x)
Definition: specfun.h:579
float laguerref(unsigned int __n, float __x)
Definition: specfun.h:931
long double cyl_bessel_jl(long double __nu, long double __x)
Definition: specfun.h:558
__gnu_cxx::__promote< _Tp >::__type comp_ellint_1(_Tp __k)
Definition: specfun.h:389
__gnu_cxx::__promote_2< _Tp, _Tpp >::__type ellint_2(_Tp __k, _Tpp __phi)
Definition: specfun.h:775
__gnu_cxx::__promote< _Tp >::__type laguerre(unsigned int __n, _Tp __x)
Definition: specfun.h:960
float legendref(unsigned int __l, float __x)
Definition: specfun.h:975
__gnu_cxx::__promote_2< _Tpnu, _Tp >::__type cyl_bessel_i(_Tpnu __nu, _Tp __x)
Definition: specfun.h:533
__gnu_cxx::__promote< _Tp >::__type assoc_legendre(unsigned int __l, unsigned int __m, _Tp __x)
Definition: specfun.h:296
float assoc_laguerref(unsigned int __n, unsigned int __m, float __x)
Definition: specfun.h:204
long double cyl_neumannl(long double __nu, long double __x)
Definition: specfun.h:656
float riemann_zetaf(float __s)
Definition: specfun.h:1020
_Tp fabs(const std::complex< _Tp > &)
fabs(__z) [8.1.8].
Definition: complex:1817
std::complex< _Tp > asinh(const std::complex< _Tp > &)
asinh(__z) [8.1.6].
Definition: complex:1764
std::complex< _Tp > atan(const std::complex< _Tp > &)
atan(__z) [8.1.4].
Definition: complex:1689
std::complex< _Tp > atanh(const std::complex< _Tp > &)
atanh(__z) [8.1.7].
Definition: complex:1808
std::complex< _Tp > acosh(const std::complex< _Tp > &)
acosh(__z) [8.1.5].
Definition: complex:1725
std::complex< _Tp > acos(const std::complex< _Tp > &)
acos(__z) [8.1.2].
Definition: complex:1609
std::complex< _Tp > asin(const std::complex< _Tp > &)
asin(__z) [8.1.3].
Definition: complex:1645