Namespaces
Variants
Views
Actions

Common mathematical functions

From cppreference.com
 
 
 
Common mathematical functions
Functions
Basic operations
remainder(C++11)
remquo(C++11)
fma(C++11)
fmax(C++11)
fmin(C++11)
fdim(C++11)
nan
nanf
nanl
(C++11)
(C++11)
(C++11)
Exponential functions
exp
exp2(C++11)
expm1(C++11)
log
log10
log1p(C++11)
log2(C++11)
Power functions
sqrt
cbrt(C++11)
hypot(C++11)
pow
Trigonometric and hyperbolic functions
sinh
cosh
tanh
asinh(C++11)
acosh(C++11)
atanh(C++11)
Error and gamma functions
erf(C++11)
erfc(C++11)
lgamma(C++11)
tgamma(C++11)
Nearest integer floating point operations
ceil
floor
round
lround
llround
(C++11)
(C++11)
(C++11)
trunc(C++11)
nearbyint(C++11)
rint
lrint
llrint
(C++11)
(C++11)
(C++11)
Floating point manipulation functions
ldexp
scalbn
scalbln
(C++11)
(C++11)
ilogb(C++11)
logb(C++11)
frexp
modf
nextafter
nexttoward
(C++11)
(C++11)
copysign(C++11)
Classification
fpclassify(C++11)
isfinite(C++11)
isinf(C++11)
isnan(C++11)
isnormal(C++11)
signbit(C++11)
Macro constants
FP_NORMAL
FP_SUBNORMAL
FP_ZERO
FP_INFINITE
FP_NAN
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
FLT_EVAL_METHOD(C++11)
 

Contents

[edit] Functions

Defined in header <cmath>
Basic operations
computes absolute value of an integral value (|x|)
(function) [edit]
absolute value of a floating point value (|x|)
(function) [edit]
the quotient and remainder of integer division
(function) [edit]
remainder of the floating point division operation
(function) [edit]
(C++11)
signed remainder of the division operation
(function) [edit]
(C++11)
signed remainder as well as the three last bits of the division operation
(function) [edit]
(C++11)
fused multiply-add operation
(function) [edit]
(C++11)
larger of two floating point values
(function) [edit]
(C++11)
smaller of two floating point values
(function) [edit]
(C++11)
positive difference of two floating point values (max(0, x-y))
(function) [edit]
(C++11)
(C++11)
(C++11)
not-a-number (NaN)
(function) [edit]
Exponential functions
returns e raised to the given power (ex)
(function) [edit]
(C++11)
returns 2 raised to the given power (2x)
(function) [edit]
(C++11)
returns e raised to the given power, minus one (ex-1)
(function) [edit]
computes natural (base e) logarithm (to base e) (ln(x))
(function) [edit]
computes common (base 10) logarithm (log10(x))
(function) [edit]
(C++11)
natural logarithm (to base e) of 1 plus the given number
(function) [edit]
(C++11)
base 2 logarithm of the given number
(function) [edit]
Power functions
computes square root (x)
(function) [edit]
(C++11)
computes cubic root (3x)
(function) [edit]
(C++11)
computes square root of the sum of the squares of two given numbers (x2
+y2
)
(function) [edit]
raises a number to the given power (xy)
(function) [edit]
Trigonometric functions
computes sine (sin(x))
(function) [edit]
computes cosine (cos(x))
(function) [edit]
computes tangent (tan(x))
(function) [edit]
computes arc sine (arcsin(x))
(function) [edit]
computes arc cosine (arccos(x))
(function) [edit]
computes arc tangent (arctan(x))
(function) [edit]
arc tangent, using signs to determine quadrants
(function) [edit]
Hyperbolic functions
computes hyperbolic sine (sh(x))
(function) [edit]
computes hyperbolic cosine (ch(x))
(function) [edit]
hyperbolic tangent
(function) [edit]
(C++11)
hyperbolic arc sine
(function) [edit]
(C++11)
hyperbolic arc cosine
(function) [edit]
(C++11)
hyperbolic arc tangent
(function) [edit]
Error and gamma functions
(C++11)
error function
(function) [edit]
(C++11)
complementary error function
(function) [edit]
(C++11)
natural logarithm of the gamma function
(function) [edit]
(C++11)
gamma function
(function) [edit]
Nearest integer floating point operations
nearest integer not less than the given value
(function) [edit]
nearest integer not greater than the given value
(function) [edit]
(C++11)
nearest integer not greater in magnitude than the given value
(function) [edit]
(C++11)
(C++11)
(C++11)
nearest integer, rounding away from zero in halfway cases
(function) [edit]
(C++11)
nearest integer using current rounding mode
(function) [edit]
(C++11)
(C++11)
(C++11)
nearest integer using current rounding mode with
exception if the result differs
(function) [edit]
Floating point manipulation functions
decomposes a number into significand and a power of 2
(function) [edit]
multiplies a number by 2 raised to a power
(function) [edit]
decomposes a number into integer and fractional parts
(function) [edit]
(C++11)
(C++11)
multiplies a number by FLT_RADIX raised to a power
(function) [edit]
(C++11)
extracts exponent of the number
(function) [edit]
(C++11)
extracts exponent of the number
(function) [edit]
(C++11)
(C++11)
next representable floating point value towards the given value
(function) [edit]
(C++11)
copies the sign of a floating point value
(function) [edit]
Classification
categorizes the given floating point value
(function) [edit]
(C++11)
checks if the given number has finite value
(function) [edit]
(C++11)
checks if the given number is infinite
(function) [edit]
(C++11)
checks if the given number is NaN
(function) [edit]
(C++11)
checks if the given number is normal
(function) [edit]
(C++11)
checks if the given number is negative
(function) [edit]

[edit] Types

Defined in header <cmath>
float_t most efficient floating-point type at least as wide as float
double_t most efficient floating-point type at least as wide as double
Defined in header <cstdlib>
div_t structure type, return of the std::div function
ldiv_t structure type, return of the std::ldiv function
lldiv_t structure type, return of the std::lldiv function
Defined in header <cinttypes>
imaxdiv_t structure type, return of the std::imaxdiv function

[edit] Macro constants

Defined in header <cmath>
indicates the overflow value for float, double and long double respectively
(macro constant) [edit]
(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)
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) [edit]
Defined in header <cfloat>
specifies which types are aliased to float_t and double_t
(macro constant)