Types
float_t
(C++11)
most efficient floating-point type at least as wide as float
(typedef)
double_t
(C++11)
most efficient floating-point type at least as wide as double
(typedef)
Macros
(C++11)(C++11)
indicates the overflow value for float, double and longdouble respectively
(macro constant)
(C++11)
evaluates to positive infinity (if exists)
(macro constant)
(C++11)
evaluates to a quiet NaN of type float (if exists)
(macro constant)
(C++11)(C++11)(C++11)
defines the error handling mechanism used by the common mathematical functions
(macro constant)
Classification (C++11)(C++11)(C++11)(C++11)(C++11)
indicates a floating-point category
(macro constant)
Functions
Basic operations (C++11)(C++11)
absolute value of a floating point value (|x|)
(function)
(C++11)(C++11)
remainder of the floating point division operation
(function)
(C++11)(C++11)(C++11)
signed remainder of the division operation
(function)
(C++11)(C++11)(C++11)
signed remainder as well as the three last bits of the division operation
(function)
(C++11)(C++11)(C++11)
fused multiply-add operation
(function)
(C++11)(C++11)(C++11)
larger of two floating-point values
(function)
(C++11)(C++11)(C++11)
smaller of two floating point values
(function)
(C++11)(C++11)(C++11)
positive difference of two floating point values (max(0, x-y))
(function)
(C++11)(C++11)(C++11)
not-a-number (NaN)
(function)
Linear interpolation (C++20)
linear interpolation function
(function)
Exponential functions (C++11)(C++11)
returns e raised to the given power (ex)
(function)
(C++11)(C++11)(C++11)
returns 2 raised to the given power (2x)
(function)
(C++11)(C++11)(C++11)
returns e raised to the given power, minus 1 (ex-1)
(function)
(C++11)(C++11)
computes natural (base e) logarithm (ln(x))
(function)
(C++11)(C++11)
computes common (base 10) logarithm (log10(x))
(function)
(C++11)(C++11)(C++11)
base 2 logarithm of the given number (log2(x))
(function)
(C++11)(C++11)(C++11)
natural logarithm (to base e) of 1 plus the given number (ln(1+x))
(function)
Power functions (C++11)(C++11)
raises a number to the given power (xy)
(function)
(C++11)(C++11)
computes square root (√x)
(function)
(C++11)(C++11)(C++11)
computes cube root (3√x)
(function)
(C++11)(C++11)(C++11)
computes hypotenuse √x2
+y2
and √x2
+y2
+z2
(since C++17)
(function)
Trigonometric functions (C++11)(C++11)
computes sine (sin(x))
(function)
(C++11)(C++11)
computes cosine (cos(x))
(function)
(C++11)(C++11)
computes tangent (tan(x))
(function)
(C++11)(C++11)
computes arc sine (arcsin(x))
(function)
(C++11)(C++11)
computes arc cosine (arccos(x))
(function)
(C++11)(C++11)
computes arc tangent (arctan(x))
(function)
(C++11)(C++11)
arc tangent, using signs to determine quadrants
(function)
Hyperbolic functions (C++11)(C++11)
computes hyperbolic sine (sinh(x))
(function)
(C++11)(C++11)
computes hyperbolic cosine (cosh(x))
(function)
(C++11)(C++11)
computes hyperbolic tangent (tanh(x))
(function)
(C++11)(C++11)(C++11)
computes the inverse hyperbolic sine (arsinh(x))
(function)
(C++11)(C++11)(C++11)
computes the inverse hyperbolic cosine (arcosh(x))
(function)
(C++11)(C++11)(C++11)
computes the inverse hyperbolic tangent (artanh(x))
(function)
Error and gamma functions (C++11)(C++11)(C++11)
error function
(function)
(C++11)(C++11)(C++11)
complementary error function
(function)
(C++11)(C++11)(C++11)
gamma function
(function)
(C++11)(C++11)(C++11)
natural logarithm of the gamma function
(function)
Nearest integer floating-point operations (C++11)(C++11)
nearest integer not less than the given value
(function)
(C++11)(C++11)
nearest integer not greater than the given value
(function)
(C++11)(C++11)(C++11)
nearest integer not greater in magnitude than the given value
(function)
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
nearest integer, rounding away from zero in halfway cases
(function)
(C++11)(C++11)(C++11)
nearest integer using current rounding mode
(function)
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
nearest integer using current rounding mode with
exception if the result differs
(function)
Floating-point manipulation functions (C++11)(C++11)
decomposes a number into significand and base-2 exponent
(function)
(C++11)(C++11)
multiplies a number by 2 raised to an integral power
(function)
(C++11)(C++11)
decomposes a number into integer and fractional parts
(function)
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
multiplies a number by
raised to a power
(function)
(C++11)(C++11)(C++11)
extracts exponent of the number
(function)
(C++11)(C++11)(C++11)
extracts exponent of the number
(function)
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
next representable floating-point value towards the given value
(function)
(C++26)(C++26)(C++26)(C++26)(C++26)(C++26)
determines next representable floating-point value greater or less than the given value
(function)
(C++11)(C++11)(C++11)
copies the sign of a floating point value
(function)
Classification and comparison (C++11)
categorizes the given floating-point value
(function)
(C++11)
checks if the given number has finite value
(function)
(C++11)
checks if the given number is infinite
(function)
(C++11)
checks if the given number is NaN
(function)
(C++11)
checks if the given number is normal
(function)
(C++11)
checks if the given number is negative
(function)
(C++11)
checks if the first floating-point argument is greater than the second
(function)
(C++11)
checks if the first floating-point argument is greater or equal than the second
(function)
(C++11)
checks if the first floating-point argument is less than the second
(function)
(C++11)
checks if the first floating-point argument is less or equal than the second
(function)
(C++11)
checks if the first floating-point argument is less or greater than the second
(function)
(C++11)
checks if two floating-point values are unordered
(function)
Mathematical special functions (C++17)(C++17)(C++17)
associated Laguerre polynomials
(function)
(C++17)(C++17)(C++17)
associated Legendre polynomials
(function)
(C++17)(C++17)(C++17)
beta function
(function)
(C++17)(C++17)(C++17)
(complete) elliptic integral of the first kind
(function)
(C++17)(C++17)(C++17)
(complete) elliptic integral of the second kind
(function)
(C++17)(C++17)(C++17)
(complete) elliptic integral of the third kind
(function)
(C++17)(C++17)(C++17)
regular modified cylindrical Bessel functions
(function)
(C++17)(C++17)(C++17)
cylindrical Bessel functions (of the first kind)
(function)
(C++17)(C++17)(C++17)
irregular modified cylindrical Bessel functions
(function)
(C++17)(C++17)(C++17)
cylindrical Neumann functions
(function)
(C++17)(C++17)(C++17)
(incomplete) elliptic integral of the first kind
(function)
(C++17)(C++17)(C++17)
(incomplete) elliptic integral of the second kind
(function)
(C++17)(C++17)(C++17)
(incomplete) elliptic integral of the third kind
(function)
(C++17)(C++17)(C++17)
exponential integral
(function)
(C++17)(C++17)(C++17)
Hermite polynomials
(function)
(C++17)(C++17)(C++17)
Legendre polynomials
(function)
(C++17)(C++17)(C++17)
Laguerre polynomials
(function)
(C++17)(C++17)(C++17)
Riemann zeta function
(function)
(C++17)(C++17)(C++17)
spherical Bessel functions (of the first kind)
(function)
(C++17)(C++17)(C++17)
spherical associated Legendre functions
(function)
(C++17)(C++17)(C++17)
spherical Neumann functions
(function)
For each function with at least one parameter of type /* floating-point-type */, an overload for each cv-unqualified floating-point type is provided 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 std::abs, additional overloads are provided 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 from the provided overloads.
namespacestd{usingfloat_t=/* see description */;usingdouble_t=/* see description */;}#define HUGE_VAL /* see description */#define HUGE_VALF /* see description */#define HUGE_VALL /* see description */#define INFINITY /* see description */#define NAN /* see description */#define FP_INFINITE /* see description */#define FP_NAN /* see description */#define FP_NORMAL /* see description */#define FP_SUBNORMAL /* see description */#define FP_ZERO /* see description */#define FP_FAST_FMA /* see description */#define FP_FAST_FMAF /* see description */#define FP_FAST_FMAL /* see description */#define FP_ILOGB0 /* see description */#define FP_ILOGBNAN /* see description */#define MATH_ERRNO /* see description */#define MATH_ERREXCEPT /* see description */#define math_errhandling /* see description */namespacestd{/* floating-point-type */acos(/* floating-point-type */x);floatacosf(floatx);longdoubleacosl(longdoublex);/* floating-point-type */asin(/* floating-point-type */x);floatasinf(floatx);longdoubleasinl(longdoublex);/* floating-point-type */atan(/* floating-point-type */x);floatatanf(floatx);longdoubleatanl(longdoublex);/* floating-point-type */atan2(/* floating-point-type */y,/* floating-point-type */x);floatatan2f(floaty,floatx);longdoubleatan2l(longdoubley,longdoublex);/* floating-point-type */cos(/* floating-point-type */ex);floatcosf(floatx);longdoublecosl(longdoublex);/* floating-point-type */sin(/* floating-point-type */x);floatsinf(floatx);longdoublesinl(longdoublex);/* floating-point-type */tan(/* floating-point-type */x);floattanf(floatx);longdoubletanl(longdoublex);/* floating-point-type */acosh(/* floating-point-type */x);floatacoshf(floatx);longdoubleacoshl(longdoublex);/* floating-point-type */asinh(/* floating-point-type */x);floatasinhf(floatx);longdoubleasinhl(longdoublex);/* floating-point-type */atanh(/* floating-point-type */x);floatatanhf(floatx);longdoubleatanhl(longdoublex);/* floating-point-type */cosh(/* floating-point-type */x);floatcoshf(floatx);longdoublecoshl(longdoublex);/* floating-point-type */sinh(/* floating-point-type */x);floatsinhf(floatx);longdoublesinhl(longdoublex);/* floating-point-type */tanh(/* floating-point-type */x);floattanhf(floatx);longdoubletanhl(longdoublex);/* floating-point-type */exp(/* floating-point-type */x);floatexpf(floatx);longdoubleexpl(longdoublex);/* floating-point-type */exp2(/* floating-point-type */x);floatexp2f(floatx);longdoubleexp2l(longdoublex);/* floating-point-type */expm1(/* floating-point-type */x);floatexpm1f(floatx);longdoubleexpm1l(longdoublex);constexpr/* floating-point-type */frexp(/* floating-point-type */value,int*exp);constexprfloatfrexpf(floatvalue,int*exp);constexprlongdoublefrexpl(longdoublevalue,int*exp);constexprintilogb(/* floating-point-type */x);constexprintilogbf(floatx);constexprintilogbl(longdoublex);constexpr/* floating-point-type */ldexp(/* floating-point-type */x,intexp);constexprfloatldexpf(floatx,intexp);constexprlongdoubleldexpl(longdoublex,intexp);/* floating-point-type */log(/* floating-point-type */x);floatlogf(floatx);longdoublelogl(longdoublex);/* floating-point-type */log10(/* floating-point-type */x);floatlog10f(floatx);longdoublelog10l(longdoublex);/* floating-point-type */log1p(/* floating-point-type */x);floatlog1pf(floatx);longdoublelog1pl(longdoublex);/* floating-point-type */log2(/* floating-point-type */x);floatlog2f(floatx);longdoublelog2l(longdoublex);constexpr/* floating-point-type */logb(/* floating-point-type */x);constexprfloatlogbf(floatx);constexprlongdoublelogbl(longdoublex);constexpr/* floating-point-type */modf(/* floating-point-type */value,/* floating-point-type */*iptr);constexprfloatmodff(floatvalue,float*iptr);constexprlongdoublemodfl(longdoublevalue,longdouble*iptr);constexpr/* floating-point-type */scalbn(/* floating-point-type */x,intn);constexprfloatscalbnf(floatx,intn);constexprlongdoublescalbnl(longdoublex,intn);constexpr/* floating-point-type */scalbln(/* floating-point-type */x,longintn);constexprfloatscalblnf(floatx,longintn);constexprlongdoublescalblnl(longdoublex,longintn);/* floating-point-type */cbrt(/* floating-point-type */x);floatcbrtf(floatx);longdoublecbrtl(longdoublex);// absolute valuesconstexprintabs(intj);// freestandingconstexprlongintabs(longintj);// freestandingconstexprlonglongintabs(longlongintj);// freestandingconstexpr/* floating-point-type */abs(/* floating-point-type */j);// freestanding-deletedconstexpr/* floating-point-type */fabs(/* floating-point-type */x);constexprfloatfabsf(floatx);constexprlongdoublefabsl(longdoublex);/* floating-point-type */hypot(/* floating-point-type */x,/* floating-point-type */y);floathypotf(floatx,floaty);longdoublehypotl(longdoublex,longdoubley);// three-dimensional hypotenusefloathypot(/* floating-point-type */x,/* floating-point-type */y,/* floating-point-type */z);/* floating-point-type */pow(/* floating-point-type */x,/* floating-point-type */y);floatpowf(floatx,floaty);longdoublepowl(longdoublex,longdoubley);/* floating-point-type */sqrt(/* floating-point-type */x);floatsqrtf(floatx);longdoublesqrtl(longdoublex);/* floating-point-type */erf(/* floating-point-type */x);floaterff(floatx);longdoubleerfl(longdoublex);/* floating-point-type */erfc(/* floating-point-type */x);floaterfcf(floatx);longdoubleerfcl(longdoublex);/* floating-point-type */lgamma(/* floating-point-type */x);floatlgammaf(floatx);longdoublelgammal(longdoublex);/* floating-point-type */tgamma(/* floating-point-type */x);floattgammaf(floatx);longdoubletgammal(longdoublex);constexpr/* floating-point-type */ceil(/* floating-point-type */x);constexprfloatceilf(floatx);constexprlongdoubleceill(longdoublex);constexpr/* floating-point-type */floor(/* floating-point-type */x);constexprfloatfloorf(floatx);constexprlongdoublefloorl(longdoublex);/* floating-point-type */nearbyint(/* floating-point-type */x);floatnearbyintf(floatx);longdoublenearbyintl(longdoublex);/* floating-point-type */rint(/* floating-point-type */x);floatrintf(floatx);longdoublerintl(longdoublex);longintlrint(/* floating-point-type */x);longintlrintf(floatx);longintlrintl(longdoublex);longlongintllrint(/* floating-point-type */x);longlongintllrintf(floatx);longlongintllrintl(longdoublex);constexpr/* floating-point-type */round(/* floating-point-type */x);constexprfloatroundf(floatx);constexprlongdoubleroundl(longdoublex);constexprlongintlround(/* floating-point-type */x);constexprlongintlroundf(floatx);constexprlongintlroundl(longdoublex);constexprlonglongintllround(/* floating-point-type */x);constexprlonglongintllroundf(floatx);constexprlonglongintllroundl(longdoublex);constexpr/* floating-point-type */trunc(/* floating-point-type */x);constexprfloattruncf(floatx);constexprlongdoubletruncl(longdoublex);constexpr/* floating-point-type */fmod(/* floating-point-type */x,/* floating-point-type */y);constexprfloatfmodf(floatx,floaty);constexprlongdoublefmodl(longdoublex,longdoubley);constexpr/* floating-point-type */remainder(/* floating-point-type */x,/* floating-point-type */y);constexprfloatremainderf(floatx,floaty);constexprlongdoubleremainderl(longdoublex,longdoubley);constexpr/* floating-point-type */remquo(/* floating-point-type */x,/* floating-point-type */y,int*quo);constexprfloatremquof(floatx,floaty,int*quo);constexprlongdoubleremquol(longdoublex,longdoubley,int*quo);constexpr/* floating-point-type */copysign(/* floating-point-type */x,/* floating-point-type */y);constexprfloatcopysignf(floatx,floaty);constexprlongdoublecopysignl(longdoublex,longdoubley);doublenan(constchar*tagp);floatnanf(constchar*tagp);longdoublenanl(constchar*tagp);constexpr/* floating-point-type */nextafter(/* floating-point-type */x,/* floating-point-type */y);constexprfloatnextafterf(floatx,floaty);constexprlongdoublenextafterl(longdoublex,longdoubley);constexpr/* floating-point-type */nexttoward(/* floating-point-type */x,longdoubley);constexprfloatnexttowardf(floatx,longdoubley);constexprlongdoublenexttowardl(longdoublex,longdoubley);constexpr/* floating-point-type */nextup(/* floating-point-type */x,/* floating-point-type */y);constexprfloatnextupf(floatx,floaty);constexprlongdoublenextupl(longdoublex,longdoubley);constexpr/* floating-point-type */nextdown(/* floating-point-type */x,/* floating-point-type */y);constexprfloatnextdownf(floatx,floaty);constexprlongdoublenextdownl(longdoublex,longdoubley);constexpr/* floating-point-type */fdim(/* floating-point-type */x,/* floating-point-type */y);constexprfloatfdimf(floatx,floaty);constexprlongdoublefdiml(longdoublex,longdoubley);constexpr/* floating-point-type */fmax(/* floating-point-type */x,/* floating-point-type */y);constexprfloatfmaxf(floatx,floaty);constexprlongdoublefmaxl(longdoublex,longdoubley);constexpr/* floating-point-type */fmin(/* floating-point-type */x,/* floating-point-type */y);constexprfloatfminf(floatx,floaty);constexprlongdoublefminl(longdoublex,longdoubley);constexpr/* floating-point-type */fma(/* floating-point-type */x,/* floating-point-type */y,/* floating-point-type */z);constexprfloatfmaf(floatx,floaty,floatz);constexprlongdoublefmal(longdoublex,longdoubley,longdoublez);// linear interpolationconstexpr/* floating-point-type */lerp(/* floating-point-type */a,/* floating-point-type */b,/* floating-point-type */t)noexcept;// classification / comparison functionsconstexprintfpclassify(/* floating-point-type */x);constexprboolisfinite(/* floating-point-type */x);constexprboolisinf(/* floating-point-type */x);constexprboolisnan(/* floating-point-type */x);constexprboolisnormal(/* floating-point-type */x);constexprboolsignbit(/* floating-point-type */x);constexprboolisgreater(/* floating-point-type */x,/* floating-point-type */y);constexprboolisgreaterequal(/* floating-point-type */x,/* floating-point-type */y);constexprboolisless(/* floating-point-type */x,/* floating-point-type */y);constexprboolislessequal(/* floating-point-type */x,/* floating-point-type */y);constexprboolislessgreater(/* floating-point-type */x,/* floating-point-type */y);constexprboolisunordered(/* floating-point-type */x,/* floating-point-type */y);// mathematical special functions// associated Laguerre polynomials/* floating-point-type */assoc_laguerre(unsignedn,unsignedm,/* floating-point-type */x);floatassoc_laguerref(unsignedn,unsignedm,floatx);longdoubleassoc_laguerrel(unsignedn,unsignedm,longdoublex);// associated Legendre functions/* floating-point-type */assoc_legendre(unsignedl,unsignedm,/* floating-point-type */x);floatassoc_legendref(unsignedl,unsignedm,floatx);longdoubleassoc_legendrel(unsignedl,unsignedm,longdoublex);// beta function/* floating-point-type */beta(/* floating-point-type */x,/* floating-point-type */y);floatbetaf(floatx,floaty);longdoublebetal(longdoublex,longdoubley);// complete elliptic integral of the first kind/* floating-point-type */comp_ellint_1(/* floating-point-type */k);floatcomp_ellint_1f(floatk);longdoublecomp_ellint_1l(longdoublek);// complete elliptic integral of the second kind/* floating-point-type */comp_ellint_2(/* floating-point-type */k);floatcomp_ellint_2f(floatk);longdoublecomp_ellint_2l(longdoublek);// complete elliptic integral of the third kind/* floating-point-type */comp_ellint_3(/* floating-point-type */k,/* floating-point-type */nu);floatcomp_ellint_3f(floatk,floatnu);longdoublecomp_ellint_3l(longdoublek,longdoublenu);// regular modified cylindrical Bessel functions/* floating-point-type */cyl_bessel_i(/* floating-point-type */nu,/* floating-point-type */x);floatcyl_bessel_if(floatnu,floatx);longdoublecyl_bessel_il(longdoublenu,longdoublex);// cylindrical Bessel functions of the first kind/* floating-point-type */cyl_bessel_j(/* floating-point-type */nu,/* floating-point-type */x);floatcyl_bessel_jf(floatnu,floatx);longdoublecyl_bessel_jl(longdoublenu,longdoublex);// irregular modified cylindrical Bessel functions/* floating-point-type */cyl_bessel_k(/* floating-point-type */nu,/* floating-point-type */x);floatcyl_bessel_kf(floatnu,floatx);longdoublecyl_bessel_kl(longdoublenu,longdoublex);// cylindrical Neumann functions;// cylindrical Bessel functions of the second kind/* floating-point-type */cyl_neumann(/* floating-point-type */nu,/* floating-point-type */x);floatcyl_neumannf(floatnu,floatx);longdoublecyl_neumannl(longdoublenu,longdoublex);// incomplete elliptic integral of the first kind/* floating-point-type */ellint_1(/* floating-point-type */k,/* floating-point-type */phi);floatellint_1f(floatk,floatphi);longdoubleellint_1l(longdoublek,longdoublephi);// incomplete elliptic integral of the second kind/* floating-point-type */ellint_2(/* floating-point-type */k,/* floating-point-type */phi);floatellint_2f(floatk,floatphi);longdoubleellint_2l(longdoublek,longdoublephi);// incomplete elliptic integral of the third kind/* floating-point-type */ellint_3(/* floating-point-type */k,/* floating-point-type */nu,/* floating-point-type */phi);floatellint_3f(floatk,floatnu,floatphi);longdoubleellint_3l(longdoublek,longdoublenu,longdoublephi);// exponential integral/* floating-point-type */expint(/* floating-point-type */x);floatexpintf(floatx);longdoubleexpintl(longdoublex);// Hermite polynomials/* floating-point-type */hermite(unsignedn,/* floating-point-type */x);floathermitef(unsignedn,floatx);longdoublehermitel(unsignedn,longdoublex);// Laguerre polynomials/* floating-point-type */laguerre(unsignedn,/* floating-point-type */x);floatlaguerref(unsignedn,floatx);longdoublelaguerrel(unsignedn,longdoublex);// Legendre polynomials/* floating-point-type */legendre(unsignedl,/* floating-point-type */x);floatlegendref(unsignedl,floatx);longdoublelegendrel(unsignedl,longdoublex);// Riemann zeta function/* floating-point-type */riemann_zeta(/* floating-point-type */x);floatriemann_zetaf(floatx);longdoubleriemann_zetal(longdoublex);// spherical Bessel functions of the first kind/* floating-point-type */sph_bessel(unsignedn,/* floating-point-type */x);floatsph_besself(unsignedn,floatx);longdoublesph_bessell(unsignedn,longdoublex);// spherical associated Legendre functions/* floating-point-type */sph_legendre(unsignedl,unsignedm,/* floating-point-type */theta);floatsph_legendref(unsignedl,unsignedm,floattheta);longdoublesph_legendrel(unsignedl,unsignedm,longdoubletheta);// spherical Neumann functions;// spherical Bessel functions of the second kind/* floating-point-type */sph_neumann(unsignedn,/* floating-point-type */x);floatsph_neumannf(unsignedn,floatx);longdoublesph_neumannl(unsignedn,longdoublex);}