28 Numerics library [numerics]

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

28.7.1 Header <cmath> synopsis [cmath.syn]

namespace std { using float_t = see below; using double_t = see below; } #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 { floating-point-type acos(floating-point-type x); float acosf(float x); long double acosl(long double x); floating-point-type asin(floating-point-type x); float asinf(float x); long double asinl(long double x); floating-point-type atan(floating-point-type x); float atanf(float x); long double atanl(long double x); floating-point-type atan2(floating-point-type y, floating-point-type x); float atan2f(float y, float x); long double atan2l(long double y, long double x); floating-point-type cos(floating-point-type x); float cosf(float x); long double cosl(long double x); floating-point-type sin(floating-point-type x); float sinf(float x); long double sinl(long double x); floating-point-type tan(floating-point-type x); float tanf(float x); long double tanl(long double x); floating-point-type acosh(floating-point-type x); float acoshf(float x); long double acoshl(long double x); floating-point-type asinh(floating-point-type x); float asinhf(float x); long double asinhl(long double x); floating-point-type atanh(floating-point-type x); float atanhf(float x); long double atanhl(long double x); floating-point-type cosh(floating-point-type x); float coshf(float x); long double coshl(long double x); floating-point-type sinh(floating-point-type x); float sinhf(float x); long double sinhl(long double x); floating-point-type tanh(floating-point-type x); float tanhf(float x); long double tanhl(long double x); floating-point-type exp(floating-point-type x); float expf(float x); long double expl(long double x); floating-point-type exp2(floating-point-type x); float exp2f(float x); long double exp2l(long double x); floating-point-type expm1(floating-point-type x); float expm1f(float x); 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); floating-point-type log(floating-point-type x); float logf(float x); long double logl(long double x); floating-point-type log10(floating-point-type x); float log10f(float x); long double log10l(long double x); floating-point-type log1p(floating-point-type x); float log1pf(float x); long double log1pl(long double x); floating-point-type log2(floating-point-type x); float log2f(float x); 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); floating-point-type cbrt(floating-point-type x); float cbrtf(float x); long double cbrtl(long double x); // [c.math.abs], absolute values constexpr int abs(int j); constexpr long int abs(long int j); constexpr long long int abs(long long int j); constexpr floating-point-type abs(floating-point-type j); constexpr floating-point-type fabs(floating-point-type x); constexpr float fabsf(float x); constexpr long double fabsl(long double x); floating-point-type hypot(floating-point-type x, floating-point-type y); float hypotf(float x, float y); long double hypotl(long double x, long double y); // [c.math.hypot3], three-dimensional hypotenuse floating-point-type hypot(floating-point-type x, floating-point-type y, floating-point-type z); floating-point-type pow(floating-point-type x, floating-point-type y); float powf(float x, float y); long double powl(long double x, long double y); floating-point-type sqrt(floating-point-type x); float sqrtf(float x); long double sqrtl(long double x); floating-point-type erf(floating-point-type x); float erff(float x); long double erfl(long double x); floating-point-type erfc(floating-point-type x); float erfcf(float x); long double erfcl(long double x); floating-point-type lgamma(floating-point-type x); float lgammaf(float x); long double lgammal(long double x); floating-point-type tgamma(floating-point-type x); float tgammaf(float x); 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 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 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], linear interpolation constexpr floating-point-type lerp(floating-point-type a, floating-point-type b, floating-point-type t) noexcept; // [c.math.fpclass], classification / comparison functions constexpr 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], mathematical special functions // [sf.cmath.assoc.laguerre], 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], 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], 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], 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], 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], 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], 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], 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], 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], 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], 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], 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], 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], exponential integral floating-point-type expint(floating-point-type x); float expintf(float x); long double expintl(long double x); // [sf.cmath.hermite], 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], 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], 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], 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], 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], 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], 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); }
The contents and meaning of the header <cmath> are the same as the C standard library header <math.h>, with the addition of a three-dimensional hypotenuse function, a linear interpolation function, and the mathematical special functions described in [sf.cmath].
[Note 1: 
Several functions have additional overloads in this document, but they have the same behavior as in the C standard library.
— end note]
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]) where all uses of floating-point-type in the function signature are replaced with that floating-point type.
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.
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]) from the overloads provided by the implementation.
An invocation of nexttoward is ill-formed if the argument corresponding to the floating-point-type parameter has extended floating-point type.
See also: ISO/IEC 9899:2018, 7.12

28.7.2 Absolute values [c.math.abs]

[Note 1: 
The headers <cstdlib> and <cmath> declare the functions described in this subclause.
— end note]
constexpr int abs(int j); constexpr long int abs(long int j); constexpr long long int abs(long long int j);
Effects: These functions have the semantics specified in the C standard library for the functions abs, labs, and llabs, respectively.
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, the program is ill-formed.
[Note 2: 
Arguments that can be promoted to int are permitted for compatibility with C.
— end note]
constexpr floating-point-type abs(floating-point-type x);
Returns: The absolute value of x.
See also: ISO/IEC 9899:2018, 7.12.7.2, 7.22.6.1

28.7.3 Three-dimensional hypotenuse [c.math.hypot3]

floating-point-type hypot(floating-point-type x, floating-point-type y, floating-point-type z);
Returns: .

28.7.4 Linear interpolation [c.math.lerp]

constexpr floating-point-type lerp(floating-point-type a, floating-point-type b, floating-point-type t) noexcept;
Returns: .
Remarks: Let r be the value returned.
If isfinite(a) && isfinite(b), then:
  • If t == 0, then r == a.
  • If t == 1, then r == b.
  • If t >= 0 && t <= 1, then isfinite(r).
  • If isfinite(t) && a == b, then r == a.
  • If isfinite(t) || !isnan(t) && b-a != 0, then !isnan(r).
Let CMP(x,y) be 1 if x > y, -1 if x < y, and 0 otherwise.
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.

28.7.5 Classification / comparison functions [c.math.fpclass]

The classification / comparison functions behave the same as the C macros with the corresponding names defined in the C standard library.
See also: ISO/IEC 9899:2018, 7.12.3, 7.12.4

28.7.6 Mathematical special functions [sf.cmath]

28.7.6.1 General [sf.cmath.general]

If any argument value to any of the functions specified in [sf.cmath] is a NaN (Not a Number), the function shall return a NaN but it shall not report a domain error.
Otherwise, the function shall report a domain error for just those argument values for which:
  • the function description's Returns: element explicitly specifies a domain and those argument values fall outside the specified domain, or
  • the corresponding mathematical function value has a nonzero imaginary component, or
  • the corresponding mathematical function is not mathematically defined.238
Unless otherwise specified, each function is defined for all finite values, for negative infinity, and for positive infinity.
238)238)
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.

28.7.6.2 Associated Laguerre polynomials [sf.cmath.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);
Effects: These functions compute the associated Laguerre polynomials of their respective arguments n, m, and x.
Returns:
where n is n, m is m, and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if n >= 128 or if m >= 128.

28.7.6.3 Associated Legendre functions [sf.cmath.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);
Effects: These functions compute the associated Legendre functions of their respective arguments l, m, and x.
Returns:
where l is l, m is m, and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if l >= 128.

28.7.6.4 Beta function [sf.cmath.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);
Effects: These functions compute the beta function of their respective arguments x and y.
Returns:
where x is x and y is y.

28.7.6.5 Complete elliptic integral of the first kind [sf.cmath.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);
Effects: These functions compute the complete elliptic integral of the first kind of their respective arguments k.
Returns:
where k is k.

28.7.6.6 Complete elliptic integral of the second kind [sf.cmath.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);
Effects: These functions compute the complete elliptic integral of the second kind of their respective arguments k.
Returns:
where k is k.

28.7.6.7 Complete elliptic integral of the third kind [sf.cmath.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);
Effects: These functions compute the complete elliptic integral of the third kind of their respective arguments k and nu.
Returns:
where k is k and ν is nu.

28.7.6.8 Regular modified cylindrical Bessel functions [sf.cmath.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);
Effects: These functions compute the regular modified cylindrical Bessel functions of their respective arguments nu and x.
Returns:
where ν is nu and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if nu >= 128.

28.7.6.9 Cylindrical Bessel functions of the first kind [sf.cmath.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);
Effects: These functions compute the cylindrical Bessel functions of the first kind of their respective arguments nu and x.
Returns:
where ν is nu and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if nu >= 128.

28.7.6.10 Irregular modified cylindrical Bessel functions [sf.cmath.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);
Effects: These functions compute the irregular modified cylindrical Bessel functions of their respective arguments nu and x.
Returns:
where ν is nu and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if nu >= 128.

28.7.6.11 Cylindrical Neumann functions [sf.cmath.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);
Effects: These functions compute the cylindrical Neumann functions, also known as the cylindrical Bessel functions of the second kind, of their respective arguments nu and x.
Returns:
where ν is nu and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if nu >= 128.

28.7.6.12 Incomplete elliptic integral of the first kind [sf.cmath.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);
Effects: These functions compute the incomplete elliptic integral of the first kind of their respective arguments k and phi (phi measured in radians).
Returns:
where k is k and φ is phi.

28.7.6.13 Incomplete elliptic integral of the second kind [sf.cmath.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);
Effects: These functions compute the incomplete elliptic integral of the second kind of their respective arguments k and phi (phi measured in radians).
Returns:
where k is k and φ is phi.

28.7.6.14 Incomplete elliptic integral of the third kind [sf.cmath.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);
Effects: These functions compute the incomplete elliptic integral of the third kind of their respective arguments k, nu, and phi (phi measured in radians).
Returns:
where ν is nu, k is k, and φ is phi.

28.7.6.15 Exponential integral [sf.cmath.expint]

floating-point-type expint(floating-point-type x); float expintf(float x); long double expintl(long double x);
Effects: These functions compute the exponential integral of their respective arguments x.
Returns:
where x is x.

28.7.6.16 Hermite polynomials [sf.cmath.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);
Effects: These functions compute the Hermite polynomials of their respective arguments n and x.
Returns:
where n is n and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if n >= 128.

28.7.6.17 Laguerre polynomials [sf.cmath.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);
Effects: These functions compute the Laguerre polynomials of their respective arguments n and x.
Returns:
where n is n and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if n >= 128.

28.7.6.18 Legendre polynomials [sf.cmath.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);
Effects: These functions compute the Legendre polynomials of their respective arguments l and x.
Returns:
where l is l and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if l >= 128.

28.7.6.19 Riemann zeta function [sf.cmath.riemann.zeta]

floating-point-type riemann_zeta(floating-point-type x); float riemann_zetaf(float x); long double riemann_zetal(long double x);
Effects: These functions compute the Riemann zeta function of their respective arguments x.
Returns:
where x is x.

28.7.6.20 Spherical Bessel functions of the first kind [sf.cmath.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);
Effects: These functions compute the spherical Bessel functions of the first kind of their respective arguments n and x.
Returns:
where n is n and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if n >= 128.

28.7.6.21 Spherical associated Legendre functions [sf.cmath.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);
Effects: These functions compute the spherical associated Legendre functions of their respective arguments l, m, and theta (theta measured in radians).
Returns:
where
and l is l, m is m, and θ is theta.
Remarks: The effect of calling each of these functions is implementation-defined if l >= 128.

28.7.6.22 Spherical Neumann functions [sf.cmath.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);
Effects: These functions compute the spherical Neumann functions, also known as the spherical Bessel functions of the second kind, of their respective arguments n and x.
Returns:
where n is n and x is x.
Remarks: The effect of calling each of these functions is implementation-defined if n >= 128.