##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cmath>

From cppreference.com
< cpp‎ | header

This header was originally in the C standard library as `<math.h>`.

This header is part of the numeric library.

### [edit] Macro constants

HUGE_VALF HUGE_VAL HUGE_VALL (C++11)(C++11) | indicates the overflow value for float, double and long double respectively (macro constant) [edit]
INFINITY (C++11) | evaluates to positive infinity or the value guaranteed to overflow a float (macro constant) [edit]
NAN (C++11) | evaluates to a quiet NaN of type float (macro constant) [edit]
math_errhandling MATH_ERRNO MATH_ERREXCEPT (C++11)(C++11)(C++11) | defines the error handling mechanism used by the common mathematical functions (macro constant) [edit]
##### Classification
FP_NORMAL FP_SUBNORMAL FP_ZERO FP_INFINITE FP_NAN (C++11)(C++11)(C++11)(C++11)(C++11) | indicates a floating-point category (macro constant) [edit]

### [edit] Types

float_t (C++11) | most efficient floating-point type at least as wide as float (typedef) [edit]
double_t (C++11) | most efficient floating-point type at least as wide as double (typedef) [edit]

### [edit] Functions

##### Basic operations
abs(float) fabs | absolute value of a floating point value (|x|) (function) [edit]
fmod | remainder of the floating point division operation (function) [edit]
remainder (C++11) | signed remainder of the division operation (function) [edit]
remquo (C++11) | signed remainder as well as the three last bits of the division operation (function) [edit]
fma (C++11) | fused multiply-add operation (function) [edit]
fmax (C++11) | larger of two floating point values (function) [edit]
fmin (C++11) | smaller of two floating point values (function) [edit]
fdim (C++11) | positive difference of two floating point values (max(0, x-y)) (function) [edit]
nan nanf nanl (C++11)(C++11)(C++11) | not-a-number (NaN) (function) [edit]
##### Exponential functions
exp | returns e raised to the given power (ex) (function) [edit]
exp2 (C++11) | returns 2 raised to the given power (2x) (function) [edit]
expm1 (C++11) | returns e raised to the given power, minus one (ex-1) (function) [edit]
log | computes natural (base e) logarithm (to base e) (ln(x)) (function) [edit]
log10 | computes common (base 10) logarithm (log10(x)) (function) [edit]
log2 (C++11) | base 2 logarithm of the given number (log2(x)) (function) [edit]
log1p (C++11) | natural logarithm (to base e) of 1 plus the given number (ln(1+x)) (function) [edit]
##### Power functions
pow | raises a number to the given power (xy) (function) [edit]
sqrt | computes square root (√x) (function) [edit]
cbrt (C++11) | computes cubic root (3√x) (function) [edit]
hypot (C++11) | computes square root of the sum of the squares of two given numbers (√x2 +y2 ) (function) [edit]
##### Trigonometric functions
sin | computes sine (sin(x)) (function) [edit]
cos | computes cosine (cos(x)) (function) [edit]
tan | computes tangent (tan(x)) (function) [edit]
asin | computes arc sine (arcsin(x)) (function) [edit]
acos | computes arc cosine (arccos(x)) (function) [edit]
atan | computes arc tangent (arctan(x)) (function) [edit]
atan2 | arc tangent, using signs to determine quadrants (function) [edit]
##### Hyperbolic functions
sinh | computes hyperbolic sine (sh(x)) (function) [edit]
cosh | computes hyperbolic cosine (ch(x)) (function) [edit]
tanh | hyperbolic tangent (function) [edit]
asinh (C++11) | computes the inverse hyperbolic sine (arsinh(x)) (function) [edit]
acosh (C++11) | computes the inverse hyperbolic cosine (arcosh(x)) (function) [edit]
atanh (C++11) | computes the inverse hyperbolic tangent (artanh(x)) (function) [edit]
##### Error and gamma functions
erf (C++11) | error function (function) [edit]
erfc (C++11) | complementary error function (function) [edit]
tgamma (C++11) | gamma function (function) [edit]
lgamma (C++11) | natural logarithm of the gamma function (function) [edit]
##### Nearest integer floating point operations
ceil | nearest integer not less than the given value (function) [edit]
floor | nearest integer not greater than the given value (function) [edit]
trunc (C++11) | nearest integer not greater in magnitude than the given value (function) [edit]
round lround llround (C++11)(C++11)(C++11) | nearest integer, rounding away from zero in halfway cases (function) [edit]
nearbyint (C++11) | nearest integer using current rounding mode (function) [edit]
rint lrint llrint (C++11)(C++11)(C++11) | nearest integer using current rounding mode with exception if the result differs (function) [edit]
##### Floating point manipulation functions
frexp | decomposes a number into significand and a power of 2 (function) [edit]
ldexp | multiplies a number by 2 raised to a power (function) [edit]
modf | decomposes a number into integer and fractional parts (function) [edit]
scalbn scalbln (C++11)(C++11) | multiplies a number by FLT_RADIX raised to a power (function) [edit]
ilogb (C++11) | extracts exponent of the number (function) [edit]
logb (C++11) | extracts exponent of the number (function) [edit]
nextafter nexttoward (C++11)(C++11) | next representable floating point value towards the given value (function) [edit]
copysign (C++11) | copies the sign of a floating point value (function) [edit]
##### Classification and comparison
fpclassify (C++11) | categorizes the given floating point value (function) [edit]
isfinite (C++11) | checks if the given number has finite value (function) [edit]
isinf (C++11) | checks if the given number is infinite (function) [edit]
isnan (C++11) | checks if the given number is NaN (function) [edit]
isnormal (C++11) | checks if the given number is normal (function) [edit]
signbit (C++11) | checks if the given number is negative (function) [edit]
isgreater (C++11) | checks if the first floating-point argument is greater than the second (function) [edit]
isgreaterequal (C++11) | checks if the first floating-point argument is greater or equal than the second (function) [edit]
isless (C++11) | checks if the first floating-point argument is less than the second (function) [edit]
islessequal (C++11) | checks if the first floating-point argument is less or equal than the second (function) [edit]
islessgreater (C++11) | checks if the first floating-point argument is less or greater than the second (function) [edit]
isunordered (C++11) | checks if two floating-point values are unordered (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cmath&oldid=71827"