[c.math]

# 29 Numerics library [[numerics]](./#numerics)

## 29.7 Mathematical functions for floating-point types [c.math]

### [29.7.1](#cmath.syn) Header <cmath> synopsis [[cmath.syn]](cmath.syn)

[ð](#header:%3ccmath%3e)

#define HUGE_VAL *see below*#define HUGE_VALF *see below*#define HUGE_VALL *see below*#define INFINITY *see below*#define NAN *see below*#define FP_INFINITE *see below*#define FP_NAN *see below*#define FP_NORMAL *see below*#define FP_SUBNORMAL *see below*#define FP_ZERO *see below*#define FP_FAST_FMA *see below*#define FP_FAST_FMAF *see below*#define FP_FAST_FMAL *see below*#define FP_ILOGB0 *see below*#define FP_ILOGBNAN *see below*#define MATH_ERRNO *see below*#define MATH_ERREXCEPT *see below*#define math_errhandling *see below*namespace std {using float_t = *see below*; using double_t = *see below*; constexpr *floating-point-type* acos(*floating-point-type* x); constexpr float acosf(float x); constexpr long double acosl(long double x); constexpr *floating-point-type* asin(*floating-point-type* x); constexpr float asinf(float x); constexpr long double asinl(long double x); constexpr *floating-point-type* atan(*floating-point-type* x); constexpr float atanf(float x); constexpr long double atanl(long double x); constexpr *floating-point-type* atan2(*floating-point-type* y, *floating-point-type* x); constexpr float atan2f(float y, float x); constexpr long double atan2l(long double y, long double x); constexpr *floating-point-type* cos(*floating-point-type* x); constexpr float cosf(float x); constexpr long double cosl(long double x); constexpr *floating-point-type* sin(*floating-point-type* x); constexpr float sinf(float x); constexpr long double sinl(long double x); constexpr *floating-point-type* tan(*floating-point-type* x); constexpr float tanf(float x); constexpr long double tanl(long double x); constexpr *floating-point-type* acosh(*floating-point-type* x); constexpr float acoshf(float x); constexpr long double acoshl(long double x); constexpr *floating-point-type* asinh(*floating-point-type* x); constexpr float asinhf(float x); constexpr long double asinhl(long double x); constexpr *floating-point-type* atanh(*floating-point-type* x); constexpr float atanhf(float x); constexpr long double atanhl(long double x); constexpr *floating-point-type* cosh(*floating-point-type* x); constexpr float coshf(float x); constexpr long double coshl(long double x); constexpr *floating-point-type* sinh(*floating-point-type* x); constexpr float sinhf(float x); constexpr long double sinhl(long double x); constexpr *floating-point-type* tanh(*floating-point-type* x); constexpr float tanhf(float x); constexpr long double tanhl(long double x); constexpr *floating-point-type* exp(*floating-point-type* x); constexpr float expf(float x); constexpr long double expl(long double x); constexpr *floating-point-type* exp2(*floating-point-type* x); constexpr float exp2f(float x); constexpr long double exp2l(long double x); constexpr *floating-point-type* expm1(*floating-point-type* x); constexpr float expm1f(float x); constexpr long double expm1l(long double x); constexpr *floating-point-type* frexp(*floating-point-type* value, int* exp); constexpr float frexpf(float value, int* exp); constexpr long double frexpl(long double value, int* exp); constexpr int ilogb(*floating-point-type* x); constexpr int ilogbf(float x); constexpr int ilogbl(long double x); constexpr *floating-point-type* ldexp(*floating-point-type* x, int exp); constexpr float ldexpf(float x, int exp); constexpr long double ldexpl(long double x, int exp); constexpr *floating-point-type* log(*floating-point-type* x); constexpr float logf(float x); constexpr long double logl(long double x); constexpr *floating-point-type* log10(*floating-point-type* x); constexpr float log10f(float x); constexpr long double log10l(long double x); constexpr *floating-point-type* log1p(*floating-point-type* x); constexpr float log1pf(float x); constexpr long double log1pl(long double x); constexpr *floating-point-type* log2(*floating-point-type* x); constexpr float log2f(float x); constexpr long double log2l(long double x); constexpr *floating-point-type* logb(*floating-point-type* x); constexpr float logbf(float x); constexpr long double logbl(long double x); constexpr *floating-point-type* modf(*floating-point-type* value, *floating-point-type** iptr); constexpr float modff(float value, float* iptr); constexpr long double modfl(long double value, long double* iptr); constexpr *floating-point-type* scalbn(*floating-point-type* x, int n); constexpr float scalbnf(float x, int n); constexpr long double scalbnl(long double x, int n); constexpr *floating-point-type* scalbln(*floating-point-type* x, long int n); constexpr float scalblnf(float x, long int n); constexpr long double scalblnl(long double x, long int n); constexpr *floating-point-type* cbrt(*floating-point-type* x); constexpr float cbrtf(float x); constexpr long double cbrtl(long double x); // [[c.math.abs]](#abs "29.7.2 Absolute values"), absolute valuesconstexpr int abs(int j); // freestandingconstexpr long int abs(long int j); // freestandingconstexpr long long int abs(long long int j); // freestandingconstexpr *floating-point-type* abs(*floating-point-type* j); // freestanding-deletedconstexpr *floating-point-type* fabs(*floating-point-type* x); constexpr float fabsf(float x); constexpr long double fabsl(long double x); constexpr *floating-point-type* hypot(*floating-point-type* x, *floating-point-type* y); constexpr float hypotf(float x, float y); constexpr long double hypotl(long double x, long double y); // [[c.math.hypot3]](#hypot3 "29.7.3 Three-dimensional hypotenuse"), three-dimensional hypotenuseconstexpr *floating-point-type* hypot(*floating-point-type* x, *floating-point-type* y, *floating-point-type* z); constexpr *floating-point-type* pow(*floating-point-type* x, *floating-point-type* y); constexpr float powf(float x, float y); constexpr long double powl(long double x, long double y); constexpr *floating-point-type* sqrt(*floating-point-type* x); constexpr float sqrtf(float x); constexpr long double sqrtl(long double x); constexpr *floating-point-type* erf(*floating-point-type* x); constexpr float erff(float x); constexpr long double erfl(long double x); constexpr *floating-point-type* erfc(*floating-point-type* x); constexpr float erfcf(float x); constexpr long double erfcl(long double x); constexpr *floating-point-type* lgamma(*floating-point-type* x); constexpr float lgammaf(float x); constexpr long double lgammal(long double x); constexpr *floating-point-type* tgamma(*floating-point-type* x); constexpr float tgammaf(float x); constexpr long double tgammal(long double x); constexpr *floating-point-type* ceil(*floating-point-type* x); constexpr float ceilf(float x); constexpr long double ceill(long double x); constexpr *floating-point-type* floor(*floating-point-type* x); constexpr float floorf(float x); constexpr long double floorl(long double x); *floating-point-type* nearbyint(*floating-point-type* x); float nearbyintf(float x); long double nearbyintl(long double x); *floating-point-type* rint(*floating-point-type* x); float rintf(float x); long double rintl(long double x); long int lrint(*floating-point-type* x); long int lrintf(float x); long int lrintl(long double x); long long int llrint(*floating-point-type* x); long long int llrintf(float x); long long int llrintl(long double x); constexpr *floating-point-type* round(*floating-point-type* x); constexpr float roundf(float x); constexpr long double roundl(long double x); constexpr long int lround(*floating-point-type* x); constexpr long int lroundf(float x); constexpr long int lroundl(long double x); constexpr long long int llround(*floating-point-type* x); constexpr long long int llroundf(float x); constexpr long long int llroundl(long double x); constexpr *floating-point-type* trunc(*floating-point-type* x); constexpr float truncf(float x); constexpr long double truncl(long double x); constexpr *floating-point-type* fmod(*floating-point-type* x, *floating-point-type* y); constexpr float fmodf(float x, float y); constexpr long double fmodl(long double x, long double y); constexpr *floating-point-type* remainder(*floating-point-type* x, *floating-point-type* y); constexpr float remainderf(float x, float y); constexpr long double remainderl(long double x, long double y); constexpr *floating-point-type* remquo(*floating-point-type* x, *floating-point-type* y, int* quo); constexpr float remquof(float x, float y, int* quo); constexpr long double remquol(long double x, long double y, int* quo); constexpr *floating-point-type* copysign(*floating-point-type* x, *floating-point-type* y); constexpr float copysignf(float x, float y); constexpr long double copysignl(long double x, long double y); double nan(const char* tagp); float nanf(const char* tagp); long double nanl(const char* tagp); constexpr *floating-point-type* nextafter(*floating-point-type* x, *floating-point-type* y); constexpr float nextafterf(float x, float y); constexpr long double nextafterl(long double x, long double y); constexpr *floating-point-type* nexttoward(*floating-point-type* x, long double y); constexpr float nexttowardf(float x, long double y); constexpr long double nexttowardl(long double x, long double y); constexpr *floating-point-type* nextup(*floating-point-type* x); constexpr float nextupf(float x); constexpr long double nextupl(long double x); constexpr *floating-point-type* nextdown(*floating-point-type* x); constexpr float nextdownf(float x); constexpr long double nextdownl(long double x); constexpr *floating-point-type* fdim(*floating-point-type* x, *floating-point-type* y); constexpr float fdimf(float x, float y); constexpr long double fdiml(long double x, long double y); constexpr *floating-point-type* fmax(*floating-point-type* x, *floating-point-type* y); constexpr float fmaxf(float x, float y); constexpr long double fmaxl(long double x, long double y); constexpr *floating-point-type* fmin(*floating-point-type* x, *floating-point-type* y); constexpr float fminf(float x, float y); constexpr long double fminl(long double x, long double y); constexpr *floating-point-type* fmaximum(*floating-point-type* x, *floating-point-type* y); constexpr *floating-point-type* fmaximum_num(*floating-point-type* x, *floating-point-type* y); constexpr *floating-point-type* fminimum(*floating-point-type* x, *floating-point-type* y); constexpr *floating-point-type* fminimum_num(*floating-point-type* x, *floating-point-type* y); constexpr *floating-point-type* fma(*floating-point-type* x, *floating-point-type* y, *floating-point-type* z); constexpr float fmaf(float x, float y, float z); constexpr long double fmal(long double x, long double y, long double z); // [[c.math.lerp]](#lerp "29.7.4 Linear interpolation"), linear interpolationconstexpr *floating-point-type* lerp(*floating-point-type* a, *floating-point-type* b, *floating-point-type* t) noexcept; // [[c.math.fpclass]](#fpclass "29.7.5 Classification / comparison functions"), classification / comparison functionsconstexpr int fpclassify(*floating-point-type* x); constexpr bool isfinite(*floating-point-type* x); constexpr bool isinf(*floating-point-type* x); constexpr bool isnan(*floating-point-type* x); constexpr bool isnormal(*floating-point-type* x); constexpr bool signbit(*floating-point-type* x); constexpr bool isgreater(*floating-point-type* x, *floating-point-type* y); constexpr bool isgreaterequal(*floating-point-type* x, *floating-point-type* y); constexpr bool isless(*floating-point-type* x, *floating-point-type* y); constexpr bool islessequal(*floating-point-type* x, *floating-point-type* y); constexpr bool islessgreater(*floating-point-type* x, *floating-point-type* y); constexpr bool isunordered(*floating-point-type* x, *floating-point-type* y); // [[sf.cmath]](#sf.cmath "29.7.6 Mathematical special functions"), mathematical special functions// [[sf.cmath.assoc.laguerre]](#sf.cmath.assoc.laguerre "29.7.6.2 Associated Laguerre polynomials"), associated Laguerre polynomials*floating-point-type* assoc_laguerre(unsigned n, unsigned m, *floating-point-type* x); float assoc_laguerref(unsigned n, unsigned m, float x); long double assoc_laguerrel(unsigned n, unsigned m, long double x); // [[sf.cmath.assoc.legendre]](#sf.cmath.assoc.legendre "29.7.6.3 Associated Legendre functions"), associated Legendre functions*floating-point-type* assoc_legendre(unsigned l, unsigned m, *floating-point-type* x); float assoc_legendref(unsigned l, unsigned m, float x); long double assoc_legendrel(unsigned l, unsigned m, long double x); // [[sf.cmath.beta]](#sf.cmath.beta "29.7.6.4 Beta function"), beta function*floating-point-type* beta(*floating-point-type* x, *floating-point-type* y); float betaf(float x, float y); long double betal(long double x, long double y); // [[sf.cmath.comp.ellint.1]](#sf.cmath.comp.ellint.1 "29.7.6.5 Complete elliptic integral of the first kind"), complete elliptic integral of the first kind*floating-point-type* comp_ellint_1(*floating-point-type* k); float comp_ellint_1f(float k); long double comp_ellint_1l(long double k); // [[sf.cmath.comp.ellint.2]](#sf.cmath.comp.ellint.2 "29.7.6.6 Complete elliptic integral of the second kind"), complete elliptic integral of the second kind*floating-point-type* comp_ellint_2(*floating-point-type* k); float comp_ellint_2f(float k); long double comp_ellint_2l(long double k); // [[sf.cmath.comp.ellint.3]](#sf.cmath.comp.ellint.3 "29.7.6.7 Complete elliptic integral of the third kind"), complete elliptic integral of the third kind*floating-point-type* comp_ellint_3(*floating-point-type* k, *floating-point-type* nu); float comp_ellint_3f(float k, float nu); long double comp_ellint_3l(long double k, long double nu); // [[sf.cmath.cyl.bessel.i]](#sf.cmath.cyl.bessel.i "29.7.6.8 Regular modified cylindrical Bessel functions"), regular modified cylindrical Bessel functions*floating-point-type* cyl_bessel_i(*floating-point-type* nu, *floating-point-type* x); float cyl_bessel_if(float nu, float x); long double cyl_bessel_il(long double nu, long double x); // [[sf.cmath.cyl.bessel.j]](#sf.cmath.cyl.bessel.j "29.7.6.9 Cylindrical Bessel functions of the first kind"), cylindrical Bessel functions of the first kind*floating-point-type* cyl_bessel_j(*floating-point-type* nu, *floating-point-type* x); float cyl_bessel_jf(float nu, float x); long double cyl_bessel_jl(long double nu, long double x); // [[sf.cmath.cyl.bessel.k]](#sf.cmath.cyl.bessel.k "29.7.6.10 Irregular modified cylindrical Bessel functions"), irregular modified cylindrical Bessel functions*floating-point-type* cyl_bessel_k(*floating-point-type* nu, *floating-point-type* x); float cyl_bessel_kf(float nu, float x); long double cyl_bessel_kl(long double nu, long double x); // [[sf.cmath.cyl.neumann]](#sf.cmath.cyl.neumann "29.7.6.11 Cylindrical Neumann functions"), cylindrical Neumann functions// cylindrical Bessel functions of the second kind*floating-point-type* cyl_neumann(*floating-point-type* nu, *floating-point-type* x); float cyl_neumannf(float nu, float x); long double cyl_neumannl(long double nu, long double x); // [[sf.cmath.ellint.1]](#sf.cmath.ellint.1 "29.7.6.12 Incomplete elliptic integral of the first kind"), incomplete elliptic integral of the first kind*floating-point-type* ellint_1(*floating-point-type* k, *floating-point-type* phi); float ellint_1f(float k, float phi); long double ellint_1l(long double k, long double phi); // [[sf.cmath.ellint.2]](#sf.cmath.ellint.2 "29.7.6.13 Incomplete elliptic integral of the second kind"), incomplete elliptic integral of the second kind*floating-point-type* ellint_2(*floating-point-type* k, *floating-point-type* phi); float ellint_2f(float k, float phi); long double ellint_2l(long double k, long double phi); // [[sf.cmath.ellint.3]](#sf.cmath.ellint.3 "29.7.6.14 Incomplete elliptic integral of the third kind"), incomplete elliptic integral of the third kind*floating-point-type* ellint_3(*floating-point-type* k, *floating-point-type* nu, *floating-point-type* phi); float ellint_3f(float k, float nu, float phi); long double ellint_3l(long double k, long double nu, long double phi); // [[sf.cmath.expint]](#sf.cmath.expint "29.7.6.15 Exponential integral"), exponential integral*floating-point-type* expint(*floating-point-type* x); float expintf(float x); long double expintl(long double x); // [[sf.cmath.hermite]](#sf.cmath.hermite "29.7.6.16 Hermite polynomials"), Hermite polynomials*floating-point-type* hermite(unsigned n, *floating-point-type* x); float hermitef(unsigned n, float x); long double hermitel(unsigned n, long double x); // [[sf.cmath.laguerre]](#sf.cmath.laguerre "29.7.6.17 Laguerre polynomials"), Laguerre polynomials*floating-point-type* laguerre(unsigned n, *floating-point-type* x); float laguerref(unsigned n, float x); long double laguerrel(unsigned n, long double x); // [[sf.cmath.legendre]](#sf.cmath.legendre "29.7.6.18 Legendre polynomials"), Legendre polynomials*floating-point-type* legendre(unsigned l, *floating-point-type* x); float legendref(unsigned l, float x); long double legendrel(unsigned l, long double x); // [[sf.cmath.riemann.zeta]](#sf.cmath.riemann.zeta "29.7.6.19 Riemann zeta function"), Riemann zeta function*floating-point-type* riemann_zeta(*floating-point-type* x); float riemann_zetaf(float x); long double riemann_zetal(long double x); // [[sf.cmath.sph.bessel]](#sf.cmath.sph.bessel "29.7.6.20 Spherical Bessel functions of the first kind"), spherical Bessel functions of the first kind*floating-point-type* sph_bessel(unsigned n, *floating-point-type* x); float sph_besself(unsigned n, float x); long double sph_bessell(unsigned n, long double x); // [[sf.cmath.sph.legendre]](#sf.cmath.sph.legendre "29.7.6.21 Spherical associated Legendre functions"), spherical associated Legendre functions*floating-point-type* sph_legendre(unsigned l, unsigned m, *floating-point-type* theta); float sph_legendref(unsigned l, unsigned m, float theta); long double sph_legendrel(unsigned l, unsigned m, long double theta); // [[sf.cmath.sph.neumann]](#sf.cmath.sph.neumann "29.7.6.22 Spherical Neumann functions"), spherical Neumann functions;// spherical Bessel functions of the second kind*floating-point-type* sph_neumann(unsigned n, *floating-point-type* x); float sph_neumannf(unsigned n, float x); long double sph_neumannl(unsigned n, long double x);}

[1](#cmath.syn-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9795)

The contents and meaning of the header [<cmath>](#header:%3ccmath%3e "29.7.1 Header <cmath> synopsis [cmath.syn]") are a subset of the C standard library header [<math.h>](support.c.headers.general#header:%3cmath.h%3e "17.15.1 General [support.c.headers.general]") and
only the declarations shown in the synopsis above are present,
with the addition of
a [three-dimensional hypotenuse function](#hypot3 "29.7.3 Three-dimensional hypotenuse [c.math.hypot3]"),
a [linear interpolation function](#lerp "29.7.4 Linear interpolation [c.math.lerp]"), and
the mathematical special functions described in [[sf.cmath]](#sf.cmath "29.7.6 Mathematical special functions")[.](#cmath.syn-1.sentence-1)

[*Note [1](#cmath.syn-note-1)*:

Several functions have additional overloads in this document,
but they have the same behavior as in the [C standard library](library.c "16.2 The C standard library [library.c]")[.](#cmath.syn-1.sentence-2)

â *end note*]

[2](#cmath.syn-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9808)

For each function
with at least one parameter of type *floating-point-type*,
the implementation provides
an overload for each cv-unqualified floating-point type ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))
where all uses of *floating-point-type* in the function signature
are replaced with that floating-point type[.](#cmath.syn-2.sentence-1)

[3](#cmath.syn-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9816)

For each function
with at least one parameter of type *floating-point-type* other than abs,
the implementation also provides additional overloads sufficient to ensure that,
if every argument corresponding to
a *floating-point-type* parameter has arithmetic type,
then every such argument is effectively cast to the floating-point type
with the greatest floating-point conversion rank and
greatest floating-point conversion subrank
among the types of all such arguments,
where arguments of integer type are considered to have
the same floating-point conversion rank as double[.](#cmath.syn-3.sentence-1)

If no such floating-point type with the greatest rank and subrank exists,
then overload resolution does not result in
a usable candidate ([[over.match.general]](over.match.general "12.2.1 General"))
from the overloads provided by the implementation[.](#cmath.syn-3.sentence-2)

[4](#cmath.syn-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9834)

An invocation of nexttoward is ill-formed if
the argument corresponding to the *floating-point-type* parameter
has extended floating-point type[.](#cmath.syn-4.sentence-1)

See also: ISO/IEC 9899:2024, 7.12

### [29.7.2](#abs) Absolute values [[c.math.abs]](c.math.abs)

[1](#abs-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9843)

[*Note [1](#abs-note-1)*:

The headers [<cstdlib>](cstdlib.syn#header:%3ccstdlib%3e "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") and[<cmath>](#header:%3ccmath%3e "29.7.1 Header <cmath> synopsis [cmath.syn]") declare the functions described in this subclause[.](#abs-1.sentence-1)

â *end note*]

[ð](#lib:abs_)

`constexpr int abs(int j);
constexpr long int abs(long int j);
constexpr long long int abs(long long int j);
`

[2](#abs-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9858)

*Effects*: These
functions have the semantics specified in the C standard library
for the functions abs, labs, and llabs, respectively[.](#abs-2.sentence-1)

[3](#abs-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9864)

*Remarks*: If abs is called with an argument of type X for which is_unsigned_v<X> is true and
if X cannot be converted to int by [integral promotion](conv.prom "7.3.7 Integral promotions [conv.prom]"), the program is ill-formed[.](#abs-3.sentence-1)

[*Note [2](#abs-note-2)*:

Allowing arguments that can be promoted to int provides compatibility with C[.](#abs-3.sentence-2)

â *end note*]

[ð](#abs-itemdecl:2)

`constexpr floating-point-type abs(floating-point-type x);
`

[4](#abs-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9881)

*Returns*: The absolute value of x[.](#abs-4.sentence-1)

See also: ISO/IEC 9899:2024, 7.12.7.2, 7.22.6.1

### [29.7.3](#hypot3) Three-dimensional hypotenuse [[c.math.hypot3]](c.math.hypot3)

[ð](#lib:hypot,3-argument_form)

`constexpr floating-point-type hypot(floating-point-type x, floating-point-type y,
                                    floating-point-type z);
`

[1](#hypot3-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9897)

*Returns*: âx2+y2+z2[.](#hypot3-1.sentence-1)

### [29.7.4](#lerp) Linear interpolation [[c.math.lerp]](c.math.lerp)

[ð](#lib:lerp)

`constexpr floating-point-type lerp(floating-point-type a, floating-point-type b,
                                   floating-point-type t) noexcept;
`

[1](#lerp-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9910)

*Returns*: a+t(bâa)[.](#lerp-1.sentence-1)

[2](#lerp-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9914)

*Remarks*: Let r be the value returned[.](#lerp-2.sentence-1)

If isfinite(a) && isfinite(b), then:

- [(2.1)](#lerp-2.1)

  If t == 0, then r == a[.](#lerp-2.1.sentence-1)

- [(2.2)](#lerp-2.2)

  If t == 1, then r == b[.](#lerp-2.2.sentence-1)

- [(2.3)](#lerp-2.3)

  If t >= 0 && t <= 1, then isfinite(r)[.](#lerp-2.3.sentence-1)

- [(2.4)](#lerp-2.4)

  If isfinite(t) && a == b, then r == a[.](#lerp-2.4.sentence-1)

- [(2.5)](#lerp-2.5)

  If isfinite(t) || !isnan(t) && b - a != 0, then !isnan(r)[.](#lerp-2.5.sentence-1)

Let *CMP*(x,y) be 1 if x > y,-1 if x < y, and 0 otherwise[.](#lerp-2.sentence-3)

For any t1 and t2, the product of*CMP*(lerp(a, b, t2), lerp(a, b, t1)),*CMP*(t2, t1), and*CMP*(b, a) is non-negative[.](#lerp-2.sentence-4)

### [29.7.5](#fpclass) Classification / comparison functions [[c.math.fpclass]](c.math.fpclass)

[1](#fpclass-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9936)

The classification / comparison functions behave the same as the C macros with the
corresponding names defined in the C standard library[.](#fpclass-1.sentence-1)

See also: ISO/IEC 9899:2024, 7.12.3, 7.12.4

### [29.7.6](#sf.cmath) Mathematical special functions [[sf.cmath]](sf.cmath)

#### [29.7.6.1](#sf.cmath.general) General [[sf.cmath.general]](sf.cmath.general)

[1](#sf.cmath.general-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9947)

If any argument value
to any of the functions specified in [[sf.cmath]](#sf.cmath "29.7.6 Mathematical special functions") is a NaN (Not a Number),
the function shall return a NaN
but it shall not report a domain error[.](#sf.cmath.general-1.sentence-1)

Otherwise,
the function shall report a domain error
for just those argument values
for which:

- [(1.1)](#sf.cmath.general-1.1)

the function description's *Returns*: element
 explicitly specifies a domain
 and those argument values fall
 outside the specified domain,
 or

- [(1.2)](#sf.cmath.general-1.2)

the corresponding mathematical function value
 has a nonzero imaginary component,
 or

- [(1.3)](#sf.cmath.general-1.3)

the corresponding mathematical function
 is not mathematically defined[.](#sf.cmath.general-1.sentence-2)[253](#footnote-253 "A mathematical function is mathematically defined for a given set of argument values (a) if it is explicitly defined for that set of argument values, or (b) if its limiting value exists and does not depend on the direction of approach.")

[2](#sf.cmath.general-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L9989)

Unless otherwise specified,
each function is defined
for all finite values,
for negative infinity,
and for positive infinity[.](#sf.cmath.general-2.sentence-1)

[253)](#footnote-253)[253)](#footnoteref-253)

A mathematical function
 is mathematically defined
 for a given set of argument values
 (a)
 if it is explicitly defined
 for that set of argument values,
 or
 (b)
 if its limiting value exists
 and does not depend
 on the direction of approach[.](#footnote-253.sentence-1)

#### [29.7.6.2](#sf.cmath.assoc.laguerre) Associated Laguerre polynomials [[sf.cmath.assoc.laguerre]](sf.cmath.assoc.laguerre)

[ð](#lib:assoc_laguerre)

`floating-point-type assoc_laguerre(unsigned n, unsigned m, floating-point-type x);
float        assoc_laguerref(unsigned n, unsigned m, float x);
long double  assoc_laguerrel(unsigned n, unsigned m, long double x);
`

[1](#sf.cmath.assoc.laguerre-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10009)

*Effects*: These functions compute
the associated Laguerre polynomials
of their respective argumentsn, m, and x[.](#sf.cmath.assoc.laguerre-1.sentence-1)

[2](#sf.cmath.assoc.laguerre-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10016)

*Returns*: Lmn(x),
where Lmn is given by Formula [29.22](#eq:sf.cmath.assoc.laguerre),Ln+m is given by Formula [29.37](#eq:sf.cmath.laguerre),n is n,m is m, andx is x[.](#sf.cmath.assoc.laguerre-2.sentence-1)

Lmn(x)=(â1)mdmdxmLn+m(x)Â , forÂ xâ¥0(29.22)

[3](#sf.cmath.assoc.laguerre-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10030)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if n >= 128 or if m >= 128[.](#sf.cmath.assoc.laguerre-3.sentence-1)

#### [29.7.6.3](#sf.cmath.assoc.legendre) Associated Legendre functions [[sf.cmath.assoc.legendre]](sf.cmath.assoc.legendre)

[ð](#lib:assoc_legendre)

`floating-point-type assoc_legendre(unsigned l, unsigned m, floating-point-type x);
float        assoc_legendref(unsigned l, unsigned m, float x);
long double  assoc_legendrel(unsigned l, unsigned m, long double x);
`

[1](#sf.cmath.assoc.legendre-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10051)

*Effects*: These functions compute
the associated Legendre functions
of their respective argumentsl, m, and x[.](#sf.cmath.assoc.legendre-1.sentence-1)

[2](#sf.cmath.assoc.legendre-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10058)

*Returns*: Pâm(x),
where Pâm is given by Formula [29.23](#eq:sf.cmath.assoc.legendre),Pâ is given by Formula [29.38](#eq:sf.cmath.legendre),â is l,m is m, andx is x[.](#sf.cmath.assoc.legendre-2.sentence-1)

Pâm(x)=(1âx2)m/2dmdxmPâ(x)Â , forÂ |x|â¤1(29.23)

[3](#sf.cmath.assoc.legendre-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10072)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if l >= 128[.](#sf.cmath.assoc.legendre-3.sentence-1)

#### [29.7.6.4](#sf.cmath.beta) Beta function [[sf.cmath.beta]](sf.cmath.beta)

[ð](#lib:beta)

`floating-point-type beta(floating-point-type x, floating-point-type y);
float        betaf(float x, float y);
long double  betal(long double x, long double y);
`

[1](#sf.cmath.beta-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10092)

*Effects*: These functions compute
the beta function
of their respective argumentsx and y[.](#sf.cmath.beta-1.sentence-1)

[2](#sf.cmath.beta-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10099)

*Returns*: B(x,y),
where B is given by Formula [29.24](#eq:sf.cmath.beta),x is x andy is y[.](#sf.cmath.beta-2.sentence-1)

B(x,y)=Î(x)Î(y)Î(x+y)Â , forÂ x>0,Â y>0(29.24)

#### [29.7.6.5](#sf.cmath.comp.ellint.1) Complete elliptic integral of the first kind [[sf.cmath.comp.ellint.1]](sf.cmath.comp.ellint.1)

[ð](#lib:comp_ellint_1)

`floating-point-type comp_ellint_1(floating-point-type k);
float        comp_ellint_1f(float k);
long double  comp_ellint_1l(long double k);
`

[1](#sf.cmath.comp.ellint.1-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10124)

*Effects*: These functions compute
the complete elliptic integral of the first kind
of their respective argumentsk[.](#sf.cmath.comp.ellint.1-1.sentence-1)

[2](#sf.cmath.comp.ellint.1-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10131)

*Returns*: K(k),
where K is given by Formula [29.25](#eq:sf.cmath.comp.ellint.1) andk is k[.](#sf.cmath.comp.ellint.1-2.sentence-1)

K(k)=F(k,Ï/2)Â , forÂ |k|â¤1(29.25)

[3](#sf.cmath.comp.ellint.1-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10140)

See also [[sf.cmath.ellint.1]](#sf.cmath.ellint.1 "29.7.6.12 Incomplete elliptic integral of the first kind")[.](#sf.cmath.comp.ellint.1-3.sentence-1)

#### [29.7.6.6](#sf.cmath.comp.ellint.2) Complete elliptic integral of the second kind [[sf.cmath.comp.ellint.2]](sf.cmath.comp.ellint.2)

[ð](#lib:comp_ellint_2)

`floating-point-type comp_ellint_2(floating-point-type k);
float        comp_ellint_2f(float k);
long double  comp_ellint_2l(long double k);
`

[1](#sf.cmath.comp.ellint.2-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10157)

*Effects*: These functions compute
the complete elliptic integral of the second kind
of their respective argumentsk[.](#sf.cmath.comp.ellint.2-1.sentence-1)

[2](#sf.cmath.comp.ellint.2-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10164)

*Returns*: E(k),
where E is given by Formula [29.26](#eq:sf.cmath.comp.ellint.2) andk is k[.](#sf.cmath.comp.ellint.2-2.sentence-1)

E(k)=E(k,Ï/2)Â , forÂ |k|â¤1(29.26)

[3](#sf.cmath.comp.ellint.2-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10173)

See also [[sf.cmath.ellint.2]](#sf.cmath.ellint.2 "29.7.6.13 Incomplete elliptic integral of the second kind")[.](#sf.cmath.comp.ellint.2-3.sentence-1)

#### [29.7.6.7](#sf.cmath.comp.ellint.3) Complete elliptic integral of the third kind [[sf.cmath.comp.ellint.3]](sf.cmath.comp.ellint.3)

[ð](#lib:comp_ellint_3)

`floating-point-type comp_ellint_3(floating-point-type k, floating-point-type nu);
float        comp_ellint_3f(float k, float nu);
long double  comp_ellint_3l(long double k, long double nu);
`

[1](#sf.cmath.comp.ellint.3-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10190)

*Effects*: These functions compute
the complete elliptic integral of the third kind
of their respective argumentsk and nu[.](#sf.cmath.comp.ellint.3-1.sentence-1)

[2](#sf.cmath.comp.ellint.3-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10197)

*Returns*: Î (Î½,k),
where Î  is given by Formula [29.27](#eq:sf.cmath.comp.ellint.3),k is k, andÎ½ is nu[.](#sf.cmath.comp.ellint.3-2.sentence-1)

Î (Î½,k)=Î (Î½,k,Ï/2)Â , forÂ |k|â¤1(29.27)

[3](#sf.cmath.comp.ellint.3-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10207)

See also [[sf.cmath.ellint.3]](#sf.cmath.ellint.3 "29.7.6.14 Incomplete elliptic integral of the third kind")[.](#sf.cmath.comp.ellint.3-3.sentence-1)

#### [29.7.6.8](#sf.cmath.cyl.bessel.i) Regular modified cylindrical Bessel functions [[sf.cmath.cyl.bessel.i]](sf.cmath.cyl.bessel.i)

[ð](#lib:cyl_bessel_i)

`floating-point-type cyl_bessel_i(floating-point-type nu, floating-point-type x);
float        cyl_bessel_if(float nu, float x);
long double  cyl_bessel_il(long double nu, long double x);
`

[1](#sf.cmath.cyl.bessel.i-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10224)

*Effects*: These functions compute
the regular modified cylindrical Bessel functions
of their respective argumentsnu and x[.](#sf.cmath.cyl.bessel.i-1.sentence-1)

[2](#sf.cmath.cyl.bessel.i-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10231)

*Returns*: IÎ½(x),
where IÎ½ is given by Formula [29.28](#eq:sf.cmath.cyl.bessel.i),Î½ is nu, andx is x[.](#sf.cmath.cyl.bessel.i-2.sentence-1)

IÎ½(x)=iâÎ½JÎ½(ix)=ââk=0(x/2)Î½+2kk!Î(Î½+k+1)Â , forÂ xâ¥0(29.28)

[3](#sf.cmath.cyl.bessel.i-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10244)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if nu >= 128[.](#sf.cmath.cyl.bessel.i-3.sentence-1)

[4](#sf.cmath.cyl.bessel.i-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10250)

See also [[sf.cmath.cyl.bessel.j]](#sf.cmath.cyl.bessel.j "29.7.6.9 Cylindrical Bessel functions of the first kind")[.](#sf.cmath.cyl.bessel.i-4.sentence-1)

#### [29.7.6.9](#sf.cmath.cyl.bessel.j) Cylindrical Bessel functions of the first kind [[sf.cmath.cyl.bessel.j]](sf.cmath.cyl.bessel.j)

[ð](#lib:cyl_bessel_j)

`floating-point-type cyl_bessel_j(floating-point-type nu, floating-point-type x);
float        cyl_bessel_jf(float nu, float x);
long double  cyl_bessel_jl(long double nu, long double x);
`

[1](#sf.cmath.cyl.bessel.j-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10268)

*Effects*: These functions compute
the cylindrical Bessel functions of the first kind
of their respective argumentsnu and x[.](#sf.cmath.cyl.bessel.j-1.sentence-1)

[2](#sf.cmath.cyl.bessel.j-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10275)

*Returns*: JÎ½(x),
where JÎ½ is given by Formula [29.29](#eq:sf.cmath.cyl.bessel.j),Î½ is nu, andx is x[.](#sf.cmath.cyl.bessel.j-2.sentence-1)

JÎ½(x)=ââk=0(â1)k(x/2)Î½+2kk!Î(Î½+k+1)Â , forÂ xâ¥0(29.29)

[3](#sf.cmath.cyl.bessel.j-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10287)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if nu >= 128[.](#sf.cmath.cyl.bessel.j-3.sentence-1)

#### [29.7.6.10](#sf.cmath.cyl.bessel.k) Irregular modified cylindrical Bessel functions [[sf.cmath.cyl.bessel.k]](sf.cmath.cyl.bessel.k)

[ð](#lib:cyl_bessel_k)

`floating-point-type cyl_bessel_k(floating-point-type nu, floating-point-type x);
float        cyl_bessel_kf(float nu, float x);
long double  cyl_bessel_kl(long double nu, long double x);
`

[1](#sf.cmath.cyl.bessel.k-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10308)

*Effects*: These functions compute
the irregular modified cylindrical Bessel functions
of their respective argumentsnu and x[.](#sf.cmath.cyl.bessel.k-1.sentence-1)

[2](#sf.cmath.cyl.bessel.k-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10315)

*Returns*: KÎ½(x),
where KÎ½ is given by Formula [29.30](#eq:sf.cmath.cyl.bessel.k),Î½ is nu, andx is x[.](#sf.cmath.cyl.bessel.k-2.sentence-1)

KÎ½(x)=(Ï/2)iÎ½+1(JÎ½(ix)+iNÎ½(ix))=â§âª
âª
âª
âª
âª
âª
âªâ¨âª
âª
âª
âª
âª
âª
âªâ©Ï2IâÎ½(x)âIÎ½(x)sinÎ½Ï,forÂ xâ¥0Â and non-integralÂ Î½Ï2limÎ¼âÎ½IâÎ¼(x)âIÎ¼(x)sinÎ¼Ï,forÂ xâ¥0Â and integralÂ Î½(29.30)

[3](#sf.cmath.cyl.bessel.k-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10345)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if nu >= 128[.](#sf.cmath.cyl.bessel.k-3.sentence-1)

[4](#sf.cmath.cyl.bessel.k-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10351)

See also [[sf.cmath.cyl.bessel.i]](#sf.cmath.cyl.bessel.i "29.7.6.8 Regular modified cylindrical Bessel functions"), [[sf.cmath.cyl.bessel.j]](#sf.cmath.cyl.bessel.j "29.7.6.9 Cylindrical Bessel functions of the first kind"), [[sf.cmath.cyl.neumann]](#sf.cmath.cyl.neumann "29.7.6.11 Cylindrical Neumann functions")[.](#sf.cmath.cyl.bessel.k-4.sentence-1)

#### [29.7.6.11](#sf.cmath.cyl.neumann) Cylindrical Neumann functions [[sf.cmath.cyl.neumann]](sf.cmath.cyl.neumann)

[ð](#lib:cyl_neumann)

`floating-point-type cyl_neumann(floating-point-type nu, floating-point-type x);
float        cyl_neumannf(float nu, float x);
long double  cyl_neumannl(long double nu, long double x);
`

[1](#sf.cmath.cyl.neumann-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10370)

*Effects*: These functions compute the cylindrical Neumann functions,
also known as the cylindrical Bessel functions of the second kind,
of their respective argumentsnu and x[.](#sf.cmath.cyl.neumann-1.sentence-1)

[2](#sf.cmath.cyl.neumann-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10377)

*Returns*: NÎ½(x),
where NÎ½ is given by Formula [29.31](#eq:sf.cmath.cyl.neumann),Î½ is nu, andx is x[.](#sf.cmath.cyl.neumann-2.sentence-1)

NÎ½(x)=â§âª
âª
âª
âª
âª
âª
âªâ¨âª
âª
âª
âª
âª
âª
âªâ©JÎ½(x)cosÎ½ÏâJâÎ½(x)sinÎ½Ï,forÂ xâ¥0Â and non-integralÂ Î½limÎ¼âÎ½JÎ¼(x)cosÎ¼ÏâJâÎ¼(x)sinÎ¼Ï,forÂ xâ¥0Â and integralÂ Î½(29.31)

[3](#sf.cmath.cyl.neumann-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10401)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if nu >= 128[.](#sf.cmath.cyl.neumann-3.sentence-1)

[4](#sf.cmath.cyl.neumann-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10407)

See also [[sf.cmath.cyl.bessel.j]](#sf.cmath.cyl.bessel.j "29.7.6.9 Cylindrical Bessel functions of the first kind")[.](#sf.cmath.cyl.neumann-4.sentence-1)

#### [29.7.6.12](#sf.cmath.ellint.1) Incomplete elliptic integral of the first kind [[sf.cmath.ellint.1]](sf.cmath.ellint.1)

[ð](#lib:ellint_1)

`floating-point-type ellint_1(floating-point-type k, floating-point-type phi);
float        ellint_1f(float k, float phi);
long double  ellint_1l(long double k, long double phi);
`

[1](#sf.cmath.ellint.1-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10424)

*Effects*: These functions compute
the incomplete elliptic integral of the first kind
of their respective argumentsk and phi (phi measured in radians)[.](#sf.cmath.ellint.1-1.sentence-1)

[2](#sf.cmath.ellint.1-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10431)

*Returns*: F(k, Ï),
where F is given by Formula [29.32](#eq:sf.cmath.ellint.1),k is k, andÏ is phi[.](#sf.cmath.ellint.1-2.sentence-1)

F(k,Ï)=â«Ï0dÎ¸â1âk2sin2Î¸Â , forÂ |k|â¤1(29.32)

#### [29.7.6.13](#sf.cmath.ellint.2) Incomplete elliptic integral of the second kind [[sf.cmath.ellint.2]](sf.cmath.ellint.2)

[ð](#lib:ellint_2)

`floating-point-type ellint_2(floating-point-type k, floating-point-type phi);
float        ellint_2f(float k, float phi);
long double  ellint_2l(long double k, long double phi);
`

[1](#sf.cmath.ellint.2-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10457)

*Effects*: These functions compute
the incomplete elliptic integral of the second kind
of their respective argumentsk and phi (phi measured in radians)[.](#sf.cmath.ellint.2-1.sentence-1)

[2](#sf.cmath.ellint.2-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10464)

*Returns*: E(k, Ï),
where E is given by Formula [29.33](#eq:sf.cmath.ellint.2),k is k, andÏ is phi[.](#sf.cmath.ellint.2-2.sentence-1)

E(k,Ï)=â«Ï0â1âk2sin2Î¸dÎ¸Â , forÂ |k|â¤1(29.33)

#### [29.7.6.14](#sf.cmath.ellint.3) Incomplete elliptic integral of the third kind [[sf.cmath.ellint.3]](sf.cmath.ellint.3)

[ð](#lib:ellint_3)

`floating-point-type ellint_3(floating-point-type k, floating-point-type nu,
                             floating-point-type phi);
float        ellint_3f(float k, float nu, float phi);
long double  ellint_3l(long double k, long double nu, long double phi);
`

[1](#sf.cmath.ellint.3-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10491)

*Effects*: These functions compute
the incomplete elliptic integral of the third kind
of their respective argumentsk, nu, and phi (phi measured in radians)[.](#sf.cmath.ellint.3-1.sentence-1)

[2](#sf.cmath.ellint.3-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10498)

*Returns*: Î (Î½,k,Ï),
where Î  is given by Formula [29.34](#eq:sf.cmath.ellint.3),Î½ is nu,k is k, andÏ is phi[.](#sf.cmath.ellint.3-2.sentence-1)

Î (Î½,k,Ï)=â«Ï0dÎ¸(1âÎ½sin2Î¸)â1âk2sin2Î¸Â , forÂ |k|â¤1(29.34)

#### [29.7.6.15](#sf.cmath.expint) Exponential integral [[sf.cmath.expint]](sf.cmath.expint)

[ð](#lib:expint)

`floating-point-type expint(floating-point-type x);
float        expintf(float x);
long double  expintl(long double x);
`

[1](#sf.cmath.expint-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10525)

*Effects*: These functions compute the exponential integral
of their respective argumentsx[.](#sf.cmath.expint-1.sentence-1)

[2](#sf.cmath.expint-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10531)

*Returns*: Ei(x),
where Ei is given by Formula [29.35](#eq:sf.cmath.expint) andx is x[.](#sf.cmath.expint-2.sentence-1)

Ei(x)=ââ«ââxeâttdt(29.35)

#### [29.7.6.16](#sf.cmath.hermite) Hermite polynomials [[sf.cmath.hermite]](sf.cmath.hermite)

[ð](#lib:hermite)

`floating-point-type hermite(unsigned n, floating-point-type x);
float        hermitef(unsigned n, float x);
long double  hermitel(unsigned n, long double x);
`

[1](#sf.cmath.hermite-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10556)

*Effects*: These functions compute the Hermite polynomials
of their respective argumentsn and x[.](#sf.cmath.hermite-1.sentence-1)

[2](#sf.cmath.hermite-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10562)

*Returns*: Hn(x),
where Hn is given by Formula [29.36](#eq:sf.cmath.hermite),n is n, andx is x[.](#sf.cmath.hermite-2.sentence-1)

Hn(x)=(â1)nex2dndxneâx2(29.36)

[3](#sf.cmath.hermite-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10574)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if n >= 128[.](#sf.cmath.hermite-3.sentence-1)

#### [29.7.6.17](#sf.cmath.laguerre) Laguerre polynomials [[sf.cmath.laguerre]](sf.cmath.laguerre)

[ð](#lib:laguerre)

`floating-point-type laguerre(unsigned n, floating-point-type x);
float        laguerref(unsigned n, float x);
long double  laguerrel(unsigned n, long double x);
`

[1](#sf.cmath.laguerre-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10594)

*Effects*: These functions compute the Laguerre polynomials
of their respective argumentsn and x[.](#sf.cmath.laguerre-1.sentence-1)

[2](#sf.cmath.laguerre-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10600)

*Returns*: Ln(x),
where Ln is given by Formula [29.37](#eq:sf.cmath.laguerre),n is n, andx is x[.](#sf.cmath.laguerre-2.sentence-1)

Ln(x)=exn!dndxn(xneâx)Â , forÂ xâ¥0(29.37)

[3](#sf.cmath.laguerre-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10612)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if n >= 128[.](#sf.cmath.laguerre-3.sentence-1)

#### [29.7.6.18](#sf.cmath.legendre) Legendre polynomials [[sf.cmath.legendre]](sf.cmath.legendre)

[ð](#lib:legendre)

`floating-point-type legendre(unsigned l, floating-point-type x);
float        legendref(unsigned l, float x);
long double  legendrel(unsigned l, long double x);
`

[1](#sf.cmath.legendre-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10632)

*Effects*: These functions compute the Legendre polynomials of their
respective argumentsl and x[.](#sf.cmath.legendre-1.sentence-1)

[2](#sf.cmath.legendre-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10638)

*Returns*: Pâ(x),
where Pâ is given by Formula [29.38](#eq:sf.cmath.legendre),l is l, andx is x[.](#sf.cmath.legendre-2.sentence-1)

Pâ(x)=12ââ!dâdxâ(x2â1)âÂ , forÂ |x|â¤1(29.38)

[3](#sf.cmath.legendre-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10651)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if l >= 128[.](#sf.cmath.legendre-3.sentence-1)

#### [29.7.6.19](#sf.cmath.riemann.zeta) Riemann zeta function [[sf.cmath.riemann.zeta]](sf.cmath.riemann.zeta)

[ð](#lib:riemann_zeta)

`floating-point-type riemann_zeta(floating-point-type x);
float        riemann_zetaf(float x);
long double  riemann_zetal(long double x);
`

[1](#sf.cmath.riemann.zeta-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10671)

*Effects*: These functions compute the Riemann zeta function
of their respective argumentsx[.](#sf.cmath.riemann.zeta-1.sentence-1)

[2](#sf.cmath.riemann.zeta-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10677)

*Returns*: Î¶(x),
where Î¶ is given by Formula [29.39](#eq:sf.cmath.riemann.zeta) andx is x[.](#sf.cmath.riemann.zeta-2.sentence-1)

Î¶(x)=â§âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âªâ¨âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âª
âªâ©ââk=1kâx,forÂ x>111â21âxââk=1(â1)kâ1kâx,forÂ 0â¤xâ¤12xÏxâ1sin(Ïx2)Î(1âx)Î¶(1âx),forÂ x<0(29.39)

#### [29.7.6.20](#sf.cmath.sph.bessel) Spherical Bessel functions of the first kind [[sf.cmath.sph.bessel]](sf.cmath.sph.bessel)

[ð](#lib:sph_bessel)

`floating-point-type sph_bessel(unsigned n, floating-point-type x);
float        sph_besself(unsigned n, float x);
long double  sph_bessell(unsigned n, long double x);
`

[1](#sf.cmath.sph.bessel-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10719)

*Effects*: These functions compute
the spherical Bessel functions of the first kind
of their respective argumentsn and x[.](#sf.cmath.sph.bessel-1.sentence-1)

[2](#sf.cmath.sph.bessel-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10726)

*Returns*: jn(x),
where jn is given by Formula [29.40](#eq:sf.cmath.sph.bessel),n is n, andx is x[.](#sf.cmath.sph.bessel-2.sentence-1)

jn(x)=(Ï/2x)1/2Jn+1/2(x)Â , forÂ xâ¥0(29.40)

[3](#sf.cmath.sph.bessel-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10736)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if n >= 128[.](#sf.cmath.sph.bessel-3.sentence-1)

[4](#sf.cmath.sph.bessel-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10742)

See also [[sf.cmath.cyl.bessel.j]](#sf.cmath.cyl.bessel.j "29.7.6.9 Cylindrical Bessel functions of the first kind")[.](#sf.cmath.sph.bessel-4.sentence-1)

#### [29.7.6.21](#sf.cmath.sph.legendre) Spherical associated Legendre functions [[sf.cmath.sph.legendre]](sf.cmath.sph.legendre)

[ð](#lib:sph_legendre)

`floating-point-type sph_legendre(unsigned l, unsigned m, floating-point-type theta);
float        sph_legendref(unsigned l, unsigned m, float theta);
long double  sph_legendrel(unsigned l, unsigned m, long double theta);
`

[1](#sf.cmath.sph.legendre-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10760)

*Effects*: These functions compute the spherical associated Legendre functions
of their respective argumentsl, m, and theta (theta measured in radians)[.](#sf.cmath.sph.legendre-1.sentence-1)

[2](#sf.cmath.sph.legendre-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10766)

*Returns*: Yâm(Î¸,0),
where Yâm is given by Formula [29.41](#eq:sf.cmath.sph.legendre),l is l,m is m, andÎ¸ is theta[.](#sf.cmath.sph.legendre-2.sentence-1)

Yâm(Î¸,Ï)=(â1)m[(2â+1)4Ï(ââm)!(â+m)!]1/2Pâm(cosÎ¸)eimÏÂ , forÂ |m|â¤â(29.41)

[3](#sf.cmath.sph.legendre-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10780)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if l >= 128[.](#sf.cmath.sph.legendre-3.sentence-1)

[4](#sf.cmath.sph.legendre-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10786)

See also [[sf.cmath.assoc.legendre]](#sf.cmath.assoc.legendre "29.7.6.3 Associated Legendre functions")[.](#sf.cmath.sph.legendre-4.sentence-1)

#### [29.7.6.22](#sf.cmath.sph.neumann) Spherical Neumann functions [[sf.cmath.sph.neumann]](sf.cmath.sph.neumann)

[ð](#lib:sph_neumann)

`floating-point-type sph_neumann(unsigned n, floating-point-type x);
float        sph_neumannf(unsigned n, float x);
long double  sph_neumannl(unsigned n, long double x);
`

[1](#sf.cmath.sph.neumann-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10804)

*Effects*: These functions compute the spherical Neumann functions,
also known as the spherical Bessel functions of the second kind,
of their respective argumentsn and x[.](#sf.cmath.sph.neumann-1.sentence-1)

[2](#sf.cmath.sph.neumann-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10811)

*Returns*: nn(x),
where nn is given by Formula [29.42](#eq:sf.cmath.sph.neumann),n is n, andx is x[.](#sf.cmath.sph.neumann-2.sentence-1)

nn(x)=(Ï/2x)1/2Nn+1/2(x)Â , forÂ xâ¥0(29.42)

[3](#sf.cmath.sph.neumann-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10822)

*Remarks*: The effect of calling each of these functions
is implementation-defined
if n >= 128[.](#sf.cmath.sph.neumann-3.sentence-1)

[4](#sf.cmath.sph.neumann-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L10828)

See also [[sf.cmath.cyl.neumann]](#sf.cmath.cyl.neumann "29.7.6.11 Cylindrical Neumann functions")[.](#sf.cmath.sph.neumann-4.sentence-1)
