Przejdź do głównej zawartości

Common mathematical functions

Functions

Defined in header <cstdlib>

pubabs
labs
llabs
Computes absolute value of an integral value (|x|)
pubdiv
ldiv
lldiv
Computes quotient and remainder of integer division

Defined in header <cinttypes>

pubabs
imaxabs
Computes absolute value of an integral value (|x|)
pubdiv
imaxdiv
Computes quotient and remainder of integer division

Defined in header <cmath>

Basic operations

pubabs
fabs
fabsf
fabsl
Absolute value of a floating point value (|x|)
pubfmod
fmodf
fmodl
Remainder of the floating point division operation
pubremainder
remainderf
remainderl
Signed remainder of the division operation
pubremquo
remquof
remquol
Signed remainder as well as the three last bits of the division operation
pubfma
fmaf
fmal
Fused multiply-add operation
pubfmax
fmaxf
fmaxl
Larger of two floating-point values
pubfmin
fminf
fminl
Smaller of two floating point values
pubfdim
fdimf
fdiml
Positive difference of two floating point values (max(0, x - y))
pubnan
nanf
nanl
not-a-number (NaN)

Exponential functions

pubexp
expf
expl
Returns e raised to the given power (ex)
pubexp2
exp2f
exp2l
Returns 2 raised to the given power (2x)
pubexpm1
expm1f
expm1l
Returns e raised to the given power, minues one (ex - 1)
publog
logf
logl
Computes natural (base e) logarithm (ln x)
publog10
log10f
log10l
Computes common (base 10) logarithm (log10x)
publog2
log2f
log2l
Base 2 logarithm of the given number (log2x)
publog1p
log1pf
log1pl
Natural logarithm (to base e) of 1 plus the given number(ln(1 + x))

Power functions

pubpow
powf
powl
Raises a number to the given power (xy)
pubsqrt
sqrtf
sqrtl
Computes square root (x)
pubcbrt
cbrtf
cbrtl
Computes cubic root (x)
pubhypot
hypotf
hypotl
Computes square root of the sum of the squares of two or three given numbers (x2+y2)

Trigonometric functions

pubsin
sinf
sinl
Computes sine (sin x)
pubcos
cosf
cosl
Computes cosine (cos x)
pubtan
tanf
tanl
Computes tangent (tan x)
pubasin
asinf
asinl
Computes arc sine (arcsin x)
pubacos
acosf
acosl
Computes arc cosine (arccos x)
pubatan
atanf
atanl
Computes arc tangent (arctan x)
pubatan2
atan2f
atan2l
Arc tangent, using signs to determine quadrants

Hyperbolic functions

pubsinh
sinhf
sinhl
Computes hyperbolic sine (sinh x)
pubcosh
coshf
coshl
Computes hyperbolic cosine (cosh x)
pubtanh
tanhf
tanhl
Computes hyperbolic tangent (tanh x)
pubasinh
asinhf
asinhl
Computes the inverse hyperbolic sine (arsinh x)
pubacosh
acoshf
acoshl
Computes the inverse hyperbolic cosine (arcosh x)
pubatanh
atanhf
atanhl
Computes the inverse hyperbolic tangent (artanh x)

Error and gamma functions

puberf
erff
erfl
Error function
puberfc
erfcf
erfcl
Complementary error function
pubtgamma
tgammaf
tgammal
Gamma function
publgamma
lgammaf
lgammal
Natural logarithm of the gamma function

Nearest integer floating point operations

pubceil
ceilf
ceill
Nearest integer not less than the given value
pubfloor
floorf
floorl
Nearest integer not greater than the given value
pubtrunc
truncf
truncl
Nearest integer not greater in magnitude than the given value
pubround
roundf
roundl
lround
lroundf
lroundl
llround
llroundf
llroundl
Nearest integer, rounding away from zero in halfway cases
pubnearbyint
nearbyintf
nearbyintl
Nearest integer using current rounding mode
pubrint
rintf
rintl
lrint
lrintf
lrintl
llrint
llrintf
llrintl
Nearest integer using current rounding mode with exception if t he result differs

Floating point manipulation functions

pubfrexp
frexpf
frexpl
Decomposes a number into significand and a power of 2
publdexp
ldexpf
ldexpl
Multiplies a number by 2 raised to a power
pubmodf
modff
modfl
Decomposes a number into integer and fractional parts
pubscalbn
scalbnf
scalbnl
scalbln
scalblnf
scalblnl
Multiplies a number by FLT_RADIX raised to a power
pubilogb
ilogbf
ilogbl
Extracts exponent of the number
publogb
logbf
logbl
Extracts exponent of the number
pubnextafter
nextafterf
nextafterl
nexttoward
nexttowardf
nexttowardl
Next representable floating point value towards the given value
pubcopysign
copysignf
copysignl
Copies the sign of a floating point value

Classification and comparison

pubfpclassifyCategorizes the given floating point value
pubisfiniteChecks if the given number has finite value
pubisinfChecks if the given number is infinite
pubisnanChecks if the given number is NaN
pubisnormalChecks if the given number is normal
pubsignbitChecks if the given number is negative
pubisgreaterChecks if the first floating-point argument is greater then the second
pubisgreaterequalChecks if the first floating-point argument is greater or equal then the second
pubislessChecks if the first floating-point argument is less than the second
pubislessequalChecks if the first floating-point argument is less or equal than the second
pubislessgreaterChecks if the first floating-point argument is less or greater than the second
pubisunorderedChecks if two floating-point values are unordered

Types

Defined in header <cstdlib>

pubdiv_tStructure type, return of the std::div function
publdiv_tStructure type, return of the std::ldiv function
publldiv_tStructure type, return of the std::lldiv function
pubimaxdiv_tStructure type, return of the std::imaxdiv function
pubfloat_tMost efficient floating-point type at least as wide as float
pubdouble_tMost efficient floating-point type at least as wide as double

Macro constants

Defined in header <cmath>

pubHUGE_VALF
HUGE_VAL
HUGE_VALL
Indicates the overflow value for float, double and long double respectively
pubINFINITYEvaluates to positive infinity or the value guaranteed to overflow a float
pubNANEvaluates to a quiet NaN of type float
pubmath_errhandling
MATH_ERRNO
MATH_ERREXCEPT
Defines the error handling mechanism used by the common mathematical functions

Classification

pubFP_NORMAL
FP_SUBNORMAL
FP_ZERO
FP_INFINITE
FP_NAN
Indicates a floating-point category

Common mathematical functions

Functions

Defined in header <cstdlib>

pubabs
labs
llabs
Computes absolute value of an integral value (|x|)
pubdiv
ldiv
lldiv
Computes quotient and remainder of integer division

Defined in header <cinttypes>

pubabs
imaxabs
Computes absolute value of an integral value (|x|)
pubdiv
imaxdiv
Computes quotient and remainder of integer division

Defined in header <cmath>

Basic operations

pubabs
fabs
fabsf
fabsl
Absolute value of a floating point value (|x|)
pubfmod
fmodf
fmodl
Remainder of the floating point division operation
pubremainder
remainderf
remainderl
Signed remainder of the division operation
pubremquo
remquof
remquol
Signed remainder as well as the three last bits of the division operation
pubfma
fmaf
fmal
Fused multiply-add operation
pubfmax
fmaxf
fmaxl
Larger of two floating-point values
pubfmin
fminf
fminl
Smaller of two floating point values
pubfdim
fdimf
fdiml
Positive difference of two floating point values (max(0, x - y))
pubnan
nanf
nanl
not-a-number (NaN)

Exponential functions

pubexp
expf
expl
Returns e raised to the given power (ex)
pubexp2
exp2f
exp2l
Returns 2 raised to the given power (2x)
pubexpm1
expm1f
expm1l
Returns e raised to the given power, minues one (ex - 1)
publog
logf
logl
Computes natural (base e) logarithm (ln x)
publog10
log10f
log10l
Computes common (base 10) logarithm (log10x)
publog2
log2f
log2l
Base 2 logarithm of the given number (log2x)
publog1p
log1pf
log1pl
Natural logarithm (to base e) of 1 plus the given number(ln(1 + x))

Power functions

pubpow
powf
powl
Raises a number to the given power (xy)
pubsqrt
sqrtf
sqrtl
Computes square root (x)
pubcbrt
cbrtf
cbrtl
Computes cubic root (x)
pubhypot
hypotf
hypotl
Computes square root of the sum of the squares of two or three given numbers (x2+y2)

Trigonometric functions

pubsin
sinf
sinl
Computes sine (sin x)
pubcos
cosf
cosl
Computes cosine (cos x)
pubtan
tanf
tanl
Computes tangent (tan x)
pubasin
asinf
asinl
Computes arc sine (arcsin x)
pubacos
acosf
acosl
Computes arc cosine (arccos x)
pubatan
atanf
atanl
Computes arc tangent (arctan x)
pubatan2
atan2f
atan2l
Arc tangent, using signs to determine quadrants

Hyperbolic functions

pubsinh
sinhf
sinhl
Computes hyperbolic sine (sinh x)
pubcosh
coshf
coshl
Computes hyperbolic cosine (cosh x)
pubtanh
tanhf
tanhl
Computes hyperbolic tangent (tanh x)
pubasinh
asinhf
asinhl
Computes the inverse hyperbolic sine (arsinh x)
pubacosh
acoshf
acoshl
Computes the inverse hyperbolic cosine (arcosh x)
pubatanh
atanhf
atanhl
Computes the inverse hyperbolic tangent (artanh x)

Error and gamma functions

puberf
erff
erfl
Error function
puberfc
erfcf
erfcl
Complementary error function
pubtgamma
tgammaf
tgammal
Gamma function
publgamma
lgammaf
lgammal
Natural logarithm of the gamma function

Nearest integer floating point operations

pubceil
ceilf
ceill
Nearest integer not less than the given value
pubfloor
floorf
floorl
Nearest integer not greater than the given value
pubtrunc
truncf
truncl
Nearest integer not greater in magnitude than the given value
pubround
roundf
roundl
lround
lroundf
lroundl
llround
llroundf
llroundl
Nearest integer, rounding away from zero in halfway cases
pubnearbyint
nearbyintf
nearbyintl
Nearest integer using current rounding mode
pubrint
rintf
rintl
lrint
lrintf
lrintl
llrint
llrintf
llrintl
Nearest integer using current rounding mode with exception if t he result differs

Floating point manipulation functions

pubfrexp
frexpf
frexpl
Decomposes a number into significand and a power of 2
publdexp
ldexpf
ldexpl
Multiplies a number by 2 raised to a power
pubmodf
modff
modfl
Decomposes a number into integer and fractional parts
pubscalbn
scalbnf
scalbnl
scalbln
scalblnf
scalblnl
Multiplies a number by FLT_RADIX raised to a power
pubilogb
ilogbf
ilogbl
Extracts exponent of the number
publogb
logbf
logbl
Extracts exponent of the number
pubnextafter
nextafterf
nextafterl
nexttoward
nexttowardf
nexttowardl
Next representable floating point value towards the given value
pubcopysign
copysignf
copysignl
Copies the sign of a floating point value

Classification and comparison

pubfpclassifyCategorizes the given floating point value
pubisfiniteChecks if the given number has finite value
pubisinfChecks if the given number is infinite
pubisnanChecks if the given number is NaN
pubisnormalChecks if the given number is normal
pubsignbitChecks if the given number is negative
pubisgreaterChecks if the first floating-point argument is greater then the second
pubisgreaterequalChecks if the first floating-point argument is greater or equal then the second
pubislessChecks if the first floating-point argument is less than the second
pubislessequalChecks if the first floating-point argument is less or equal than the second
pubislessgreaterChecks if the first floating-point argument is less or greater than the second
pubisunorderedChecks if two floating-point values are unordered

Types

Defined in header <cstdlib>

pubdiv_tStructure type, return of the std::div function
publdiv_tStructure type, return of the std::ldiv function
publldiv_tStructure type, return of the std::lldiv function
pubimaxdiv_tStructure type, return of the std::imaxdiv function
pubfloat_tMost efficient floating-point type at least as wide as float
pubdouble_tMost efficient floating-point type at least as wide as double

Macro constants

Defined in header <cmath>

pubHUGE_VALF
HUGE_VAL
HUGE_VALL
Indicates the overflow value for float, double and long double respectively
pubINFINITYEvaluates to positive infinity or the value guaranteed to overflow a float
pubNANEvaluates to a quiet NaN of type float
pubmath_errhandling
MATH_ERRNO
MATH_ERREXCEPT
Defines the error handling mechanism used by the common mathematical functions

Classification

pubFP_NORMAL
FP_SUBNORMAL
FP_ZERO
FP_INFINITE
FP_NAN
Indicates a floating-point category