# Common mathematical functions

## Functions​

Defined in header `<cstdlib>`

 abslabsllabs Computes absolute value of an integral value (|x|) divldivlldiv Computes quotient and remainder of integer division

Defined in header `<cinttypes>`

 absimaxabs Computes absolute value of an integral value (|x|) divimaxdiv Computes quotient and remainder of integer division

Defined in header `<cmath>`

### Basic operations​

 absfabsfabsffabsl Absolute value of a floating point value (|x|) fmodfmodffmodl Remainder of the floating point division operation remainderremainderfremainderl Signed remainder of the division operation remquoremquofremquol Signed remainder as well as the three last bits of the division operation fmafmaffmal Fused multiply-add operation fmaxfmaxffmaxl Larger of two floating-point values fminfminffminl Smaller of two floating point values fdimfdimffdiml Positive difference of two floating point values (max(0, x - y)) nannanfnanl not-a-number (NaN)

### Exponential functions​

 expexpfexpl Returns e raised to the given power (ex) exp2exp2fexp2l Returns 2 raised to the given power (2x) expm1expm1fexpm1l Returns e raised to the given power, minues one (ex - 1) loglogflogl Computes natural (base e) logarithm (ln x) log10log10flog10l Computes common (base 10) logarithm (log10x) log2log2flog2l Base 2 logarithm of the given number (log2x) log1plog1pflog1pl Natural logarithm (to base e) of 1 plus the given number(ln(1 + x))

### Power functions​

 powpowfpowl Raises a number to the given power (xy) sqrtsqrtfsqrtl Computes square root (√x) cbrtcbrtfcbrtl Computes cubic root (∛x) hypothypotfhypotl Computes square root of the sum of the squares of two or three given numbers (√x2+y2)

### Trigonometric functions​

 sinsinfsinl Computes sine (sin x) coscosfcosl Computes cosine (cos x) tantanftanl Computes tangent (tan x) asinasinfasinl Computes arc sine (arcsin x) acosacosfacosl Computes arc cosine (arccos x) atanatanfatanl Computes arc tangent (arctan x) atan2atan2fatan2l Arc tangent, using signs to determine quadrants

### Hyperbolic functions​

 sinhsinhfsinhl Computes hyperbolic sine (sinh x) coshcoshfcoshl Computes hyperbolic cosine (cosh x) tanhtanhftanhl Computes hyperbolic tangent (tanh x) asinhasinhfasinhl Computes the inverse hyperbolic sine (arsinh x) acoshacoshfacoshl Computes the inverse hyperbolic cosine (arcosh x) atanhatanhfatanhl Computes the inverse hyperbolic tangent (artanh x)

### Error and gamma functions​

 erferfferfl Error function erfcerfcferfcl Complementary error function tgammatgammaftgammal Gamma function lgammalgammaflgammal Natural logarithm of the gamma function

### Nearest integer floating point operations​

 ceilceilfceill Nearest integer not less than the given value floorfloorffloorl Nearest integer not greater than the given value trunctruncftruncl Nearest integer not greater in magnitude than the given value roundroundfroundllroundlroundflroundlllroundllroundfllroundl Nearest integer, rounding away from zero in halfway cases nearbyintnearbyintfnearbyintl Nearest integer using current rounding mode rintrintfrintllrintlrintflrintlllrintllrintfllrintl Nearest integer using current rounding mode with exception if t he result differs

### Floating point manipulation functions​

 frexpfrexpffrexpl Decomposes a number into significand and a power of 2 ldexpldexpfldexpl Multiplies a number by 2 raised to a power modfmodffmodfl Decomposes a number into integer and fractional parts scalbnscalbnfscalbnlscalblnscalblnfscalblnl Multiplies a number by FLT_RADIX raised to a power ilogbilogbfilogbl Extracts exponent of the number logblogbflogbl Extracts exponent of the number nextafternextafterfnextafterlnexttowardnexttowardfnexttowardl Next representable floating point value towards the given value copysigncopysignfcopysignl Copies the sign of a floating point value

### Classification and comparison​

 fpclassify Categorizes the given floating point value isfinite Checks if the given number has finite value isinf Checks if the given number is infinite isnan Checks if the given number is NaN isnormal Checks if the given number is normal signbit Checks if the given number is negative isgreater Checks if the first floating-point argument is greater then the second isgreaterequal Checks if the first floating-point argument is greater or equal then the second isless Checks if the first floating-point argument is less than the second islessequal Checks if the first floating-point argument is less or equal than the second islessgreater Checks if the first floating-point argument is less or greater than the second isunordered Checks if two floating-point values are unordered

## Types​

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 imaxdiv_t Structure type, return of the `std::imaxdiv` function 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`

## Macro constants​

Defined in header `<cmath>`

 HUGE_VALFHUGE_VALHUGE_VALL Indicates the overflow value for `float`, `double` and `long double` respectively INFINITY Evaluates to positive infinity or the value guaranteed to overflow a `float` NAN Evaluates to a quiet NaN of type `float` math_errhandlingMATH_ERRNOMATH_ERREXCEPT Defines the error handling mechanism used by the common mathematical functions

### Classification​

 FP_NORMALFP_SUBNORMALFP_ZEROFP_INFINITEFP_NAN Indicates a floating-point category

# Common mathematical functions

## Functions​

Defined in header `<cstdlib>`

 abslabsllabs Computes absolute value of an integral value (|x|) divldivlldiv Computes quotient and remainder of integer division

Defined in header `<cinttypes>`

 absimaxabs Computes absolute value of an integral value (|x|) divimaxdiv Computes quotient and remainder of integer division

Defined in header `<cmath>`

### Basic operations​

 absfabsfabsffabsl Absolute value of a floating point value (|x|) fmodfmodffmodl Remainder of the floating point division operation remainderremainderfremainderl Signed remainder of the division operation remquoremquofremquol Signed remainder as well as the three last bits of the division operation fmafmaffmal Fused multiply-add operation fmaxfmaxffmaxl Larger of two floating-point values fminfminffminl Smaller of two floating point values fdimfdimffdiml Positive difference of two floating point values (max(0, x - y)) nannanfnanl not-a-number (NaN)

### Exponential functions​

 expexpfexpl Returns e raised to the given power (ex) exp2exp2fexp2l Returns 2 raised to the given power (2x) expm1expm1fexpm1l Returns e raised to the given power, minues one (ex - 1) loglogflogl Computes natural (base e) logarithm (ln x) log10log10flog10l Computes common (base 10) logarithm (log10x) log2log2flog2l Base 2 logarithm of the given number (log2x) log1plog1pflog1pl Natural logarithm (to base e) of 1 plus the given number(ln(1 + x))

### Power functions​

 powpowfpowl Raises a number to the given power (xy) sqrtsqrtfsqrtl Computes square root (√x) cbrtcbrtfcbrtl Computes cubic root (∛x) hypothypotfhypotl Computes square root of the sum of the squares of two or three given numbers (√x2+y2)

### Trigonometric functions​

 sinsinfsinl Computes sine (sin x) coscosfcosl Computes cosine (cos x) tantanftanl Computes tangent (tan x) asinasinfasinl Computes arc sine (arcsin x) acosacosfacosl Computes arc cosine (arccos x) atanatanfatanl Computes arc tangent (arctan x) atan2atan2fatan2l Arc tangent, using signs to determine quadrants

### Hyperbolic functions​

 sinhsinhfsinhl Computes hyperbolic sine (sinh x) coshcoshfcoshl Computes hyperbolic cosine (cosh x) tanhtanhftanhl Computes hyperbolic tangent (tanh x) asinhasinhfasinhl Computes the inverse hyperbolic sine (arsinh x) acoshacoshfacoshl Computes the inverse hyperbolic cosine (arcosh x) atanhatanhfatanhl Computes the inverse hyperbolic tangent (artanh x)

### Error and gamma functions​

 erferfferfl Error function erfcerfcferfcl Complementary error function tgammatgammaftgammal Gamma function lgammalgammaflgammal Natural logarithm of the gamma function

### Nearest integer floating point operations​

 ceilceilfceill Nearest integer not less than the given value floorfloorffloorl Nearest integer not greater than the given value trunctruncftruncl Nearest integer not greater in magnitude than the given value roundroundfroundllroundlroundflroundlllroundllroundfllroundl Nearest integer, rounding away from zero in halfway cases nearbyintnearbyintfnearbyintl Nearest integer using current rounding mode rintrintfrintllrintlrintflrintlllrintllrintfllrintl Nearest integer using current rounding mode with exception if t he result differs

### Floating point manipulation functions​

 frexpfrexpffrexpl Decomposes a number into significand and a power of 2 ldexpldexpfldexpl Multiplies a number by 2 raised to a power modfmodffmodfl Decomposes a number into integer and fractional parts scalbnscalbnfscalbnlscalblnscalblnfscalblnl Multiplies a number by FLT_RADIX raised to a power ilogbilogbfilogbl Extracts exponent of the number logblogbflogbl Extracts exponent of the number nextafternextafterfnextafterlnexttowardnexttowardfnexttowardl Next representable floating point value towards the given value copysigncopysignfcopysignl Copies the sign of a floating point value

### Classification and comparison​

 fpclassify Categorizes the given floating point value isfinite Checks if the given number has finite value isinf Checks if the given number is infinite isnan Checks if the given number is NaN isnormal Checks if the given number is normal signbit Checks if the given number is negative isgreater Checks if the first floating-point argument is greater then the second isgreaterequal Checks if the first floating-point argument is greater or equal then the second isless Checks if the first floating-point argument is less than the second islessequal Checks if the first floating-point argument is less or equal than the second islessgreater Checks if the first floating-point argument is less or greater than the second isunordered Checks if two floating-point values are unordered

## Types​

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 imaxdiv_t Structure type, return of the `std::imaxdiv` function 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`

## Macro constants​

Defined in header `<cmath>`

 HUGE_VALFHUGE_VALHUGE_VALL Indicates the overflow value for `float`, `double` and `long double` respectively INFINITY Evaluates to positive infinity or the value guaranteed to overflow a `float` NAN Evaluates to a quiet NaN of type `float` math_errhandlingMATH_ERRNOMATH_ERREXCEPT Defines the error handling mechanism used by the common mathematical functions

### Classification​

 FP_NORMALFP_SUBNORMALFP_ZEROFP_INFINITEFP_NAN Indicates a floating-point category