Standard library header <cmath>
From cppreference.com
This header was originally in the C standard library as <math.h>
.
This header is part of the numeric library.
Macro constants
(C++11)(C++11) |
indicates the overflow value for float, double and long double respectively (macro constant) |
(C++11) |
evaluates to positive infinity or the value guaranteed to overflow a float (macro constant) |
(C++11) |
evaluates to a quiet NaN of type float (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) |
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) |
Functions
Basic operations | |
absolute value of a floating point value (|x|) (function) | |
remainder of the floating point division operation (function) | |
(C++11) |
signed remainder of the division operation (function) |
(C++11) |
signed remainder as well as the three last bits of the division operation (function) |
(C++11) |
fused multiply-add operation (function) |
(C++11) |
larger of two floating point values (function) |
(C++11) |
smaller of two floating point values (function) |
(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) |
Exponential functions | |
returns e raised to the given power (ex) (function) | |
(C++11) |
returns 2 raised to the given power (2x) (function) |
(C++11) |
returns e raised to the given power, minus one (ex-1) (function) |
computes natural (base e) logarithm (ln(x)) (function) | |
computes common (base 10) logarithm (log10(x)) (function) | |
(C++11) |
base 2 logarithm of the given number (log2(x)) (function) |
(C++11) |
natural logarithm (to base e) of 1 plus the given number (ln(1+x)) (function) |
Power functions | |
raises a number to the given power (xy) (function) | |
computes square root (x) (function) | |
(C++11) |
computes cubic root (3x) (function) |
(C++11) |
computes square root of the sum of the squares of two given numbers (x2 +y2 ) (function) |
Trigonometric functions | |
computes sine (sin(x)) (function) | |
computes cosine (cos(x)) (function) | |
computes tangent (tan(x)) (function) | |
computes arc sine (arcsin(x)) (function) | |
computes arc cosine (arccos(x)) (function) | |
computes arc tangent (arctan(x)) (function) | |
arc tangent, using signs to determine quadrants (function) | |
Hyperbolic functions | |
computes hyperbolic sine (sh(x)) (function) | |
computes hyperbolic cosine (ch(x)) (function) | |
hyperbolic tangent (function) | |
(C++11) |
computes the inverse hyperbolic sine (arsinh(x)) (function) |
(C++11) |
computes the inverse hyperbolic cosine (arcosh(x)) (function) |
(C++11) |
computes the inverse hyperbolic tangent (artanh(x)) (function) |
Error and gamma functions | |
(C++11) |
error function (function) |
(C++11) |
complementary error function (function) |
(C++11) |
gamma function (function) |
(C++11) |
natural logarithm of the gamma function (function) |
Nearest integer floating point operations | |
nearest integer not less than the given value (function) | |
nearest integer not greater than the given value (function) | |
(C++11) |
nearest integer not greater in magnitude than the given value (function) |
(C++11)(C++11)(C++11) |
nearest integer, rounding away from zero in halfway cases (function) |
(C++11) |
nearest integer using current rounding mode (function) |
(C++11)(C++11)(C++11) |
nearest integer using current rounding mode with exception if the result differs (function) |
Floating point manipulation functions | |
decomposes a number into significand and a power of 2 (function) | |
multiplies a number by 2 raised to a power (function) | |
decomposes a number into integer and fractional parts (function) | |
(C++11)(C++11) |
multiplies a number by FLT_RADIX raised to a power (function) |
(C++11) |
extracts exponent of the number (function) |
(C++11) |
extracts exponent of the number (function) |
(C++11)(C++11) |
next representable floating point value towards the given value (function) |
(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) |
Special mathematical 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) |