Common mathematical functions
Functions
Defined in header <cstdlib>
pub | abs labs llabs | Computes absolute value of an integral value (|x|) |
pub | div ldiv lldiv | Computes quotient and remainder of integer division |
Defined in header <cinttypes>
pub | abs imaxabs | Computes absolute value of an integral value (|x|) |
pub | div imaxdiv | Computes quotient and remainder of integer division |
Defined in header <cmath>
Basic operations
pub | abs fabs fabsf fabsl | Absolute value of a floating point value (|x|) |
pub | fmod fmodf fmodl | Remainder of the floating point division operation |
pub | remainder remainderf remainderl | Signed remainder of the division operation |
pub | remquo remquof remquol | Signed remainder as well as the three last bits of the division operation |
pub | fma fmaf fmal | Fused multiply-add operation |
pub | fmax fmaxf fmaxl | Larger of two floating-point values |
pub | fmin fminf fminl | Smaller of two floating point values |
pub | fdim fdimf fdiml | Positive difference of two floating point values (max(0, x - y)) |
pub | nan nanf nanl | not-a-number (NaN) |
Exponential functions
pub | exp expf expl | Returns e raised to the given power (ex) |
pub | exp2 exp2f exp2l | Returns 2 raised to the given power (2x) |
pub | expm1 expm1f expm1l | Returns e raised to the given power, minues one (ex - 1) |
pub | log logf logl | Computes natural (base e) logarithm (ln x) |
pub | log10 log10f log10l | Computes common (base 10) logarithm (log10x) |
pub | log2 log2f log2l | Base 2 logarithm of the given number (log2x) |
pub | log1p log1pf log1pl | Natural logarithm (to base e) of 1 plus the given number(ln(1 + x)) |
Power functions
pub | pow powf powl | Raises a number to the given power (xy) |
pub | sqrt sqrtf sqrtl | Computes square root (√x) |
pub | cbrt cbrtf cbrtl | Computes cubic root (∛x) |
pub | hypot hypotf hypotl | Computes square root of the sum of the squares of two or three given numbers (√x2+y2) |
Trigonometric functions
pub | sin sinf sinl | Computes sine (sin x) |
pub | cos cosf cosl | Computes cosine (cos x) |
pub | tan tanf tanl | Computes tangent (tan x) |
pub | asin asinf asinl | Computes arc sine (arcsin x) |
pub | acos acosf acosl | Computes arc cosine (arccos x) |
pub | atan atanf atanl | Computes arc tangent (arctan x) |
pub | atan2 atan2f atan2l | Arc tangent, using signs to determine quadrants |
Hyperbolic functions
pub | sinh sinhf sinhl | Computes hyperbolic sine (sinh x) |
pub | cosh coshf coshl | Computes hyperbolic cosine (cosh x) |
pub | tanh tanhf tanhl | Computes hyperbolic tangent (tanh x) |
pub | asinh asinhf asinhl | Computes the inverse hyperbolic sine (arsinh x) |
pub | acosh acoshf acoshl | Computes the inverse hyperbolic cosine (arcosh x) |
pub | atanh atanhf atanhl | Computes the inverse hyperbolic tangent (artanh x) |
Error and gamma functions
pub | erf erff erfl | Error function |
pub | erfc erfcf erfcl | Complementary error function |
pub | tgamma tgammaf tgammal | Gamma function |
pub | lgamma lgammaf lgammal | Natural logarithm of the gamma function |
Nearest integer floating point operations
pub | ceil ceilf ceill | Nearest integer not less than the given value |
pub | floor floorf floorl | Nearest integer not greater than the given value |
pub | trunc truncf truncl | Nearest integer not greater in magnitude than the given value |
pub | round roundf roundl lround lroundf lroundl llround llroundf llroundl | Nearest integer, rounding away from zero in halfway cases |
pub | nearbyint nearbyintf nearbyintl | Nearest integer using current rounding mode |
pub | rint 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
pub | frexp frexpf frexpl | Decomposes a number into significand and a power of 2 |
pub | ldexp ldexpf ldexpl | Multiplies a number by 2 raised to a power |
pub | modf modff modfl | Decomposes a number into integer and fractional parts |
pub | scalbn scalbnf scalbnl scalbln scalblnf scalblnl | Multiplies a number by FLT_RADIX raised to a power |
pub | ilogb ilogbf ilogbl | Extracts exponent of the number |
pub | logb logbf logbl | Extracts exponent of the number |
pub | nextafter nextafterf nextafterl nexttoward nexttowardf nexttowardl | Next representable floating point value towards the given value |
pub | copysign copysignf copysignl | Copies the sign of a floating point value |
Classification and comparison
pub | fpclassify | Categorizes the given floating point value |
pub | isfinite | Checks if the given number has finite value |
pub | isinf | Checks if the given number is infinite |
pub | isnan | Checks if the given number is NaN |
pub | isnormal | Checks if the given number is normal |
pub | signbit | Checks if the given number is negative |
pub | isgreater | Checks if the first floating-point argument is greater then the second |
pub | isgreaterequal | Checks if the first floating-point argument is greater or equal then the second |
pub | isless | Checks if the first floating-point argument is less than the second |
pub | islessequal | Checks if the first floating-point argument is less or equal than the second |
pub | islessgreater | Checks if the first floating-point argument is less or greater than the second |
pub | isunordered | Checks if two floating-point values are unordered |
Types
Defined in header <cstdlib>
pub | div_t | Structure type, return of the std::div function |
pub | ldiv_t | Structure type, return of the std::ldiv function |
pub | lldiv_t | Structure type, return of the std::lldiv function |
pub | imaxdiv_t | Structure type, return of the std::imaxdiv function |
pub | float_t | Most efficient floating-point type at least as wide as float |
pub | double_t | Most efficient floating-point type at least as wide as double |
Macro constants
Defined in header <cmath>
pub | HUGE_VALF HUGE_VAL HUGE_VALL | Indicates the overflow value for float , double and long double respectively |
pub | INFINITY | Evaluates to positive infinity or the value guaranteed to overflow a float |
pub | NAN | Evaluates to a quiet NaN of type float |
pub | math_errhandling MATH_ERRNO MATH_ERREXCEPT | Defines the error handling mechanism used by the common mathematical functions |
Classification
pub | FP_NORMAL FP_SUBNORMAL FP_ZERO FP_INFINITE FP_NAN | Indicates a floating-point category |