Common mathematical functions
From cppreference.com
 
 
 
 
 
 C++ 
 Feature test macros (C++20)
 Concepts library (C++20)
 Metaprogramming library (C++11)
 Ranges library (C++20)
 Filesystem library (C++17)
 Concurrency support library (C++11)
 Execution control library (C++26)
Numerics library 
 
 
 
 
Interpolations  
 
 
 
 Generic numeric operations  
 
 
 
 
 
 
 C-style checked integer arithmetic  
 
 
 
 
  Common mathematical functions
 Mathematical special functions (C++17)
 Mathematical constants (C++20)
 Basic linear algebra algorithms (C++26)
 Data-parallel types (SIMD) (C++26)
 Floating-point environment (C++11)
 Bit manipulation (C++20)
 Saturation arithmetic (C++26)
(C++17)
(C++17)
(C++20)
(C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
Common mathematical functions
 Floating point manipulation functions  Classification and comparison  
 
 
 
 
 
 
 Types  Macro constants  
 
 
 
 
(function) [edit]
 
 positive difference of two floating point values (\({\small\max{(0, x-y)}}\)max(0, x-y)) 
(function) [edit]
 
 
 returns e raised to the given power, minus 1 (\({\small e^x-1}\)ex-1) 
(function) [edit]
 
 computes common (base 10) logarithm (\({\small\log_{10}{x}}\)log10(x)) 
(function) [edit]
 
 base 2 logarithm of the given number (\({\small\log_{2}{x}}\)log2(x)) 
(function) [edit]
 
 natural logarithm (to base e) of 1 plus the given number (\({\small\ln{(1+x)}}\)ln(1+x)) 
(function) [edit]
 
 
 computes hypotenuse \(\scriptsize{\sqrt{x^2+y^2}}\)√x2
+y2
and \(\scriptsize{\sqrt{x^2+y^2+z^2}}\)√x2
+y2
+z2
(since C++17)
(function) [edit]
 
 
 
 computes the inverse hyperbolic sine (\({\small\operatorname{arsinh}{x}}\)arsinh(x)) 
(function) [edit]
 
 computes the inverse hyperbolic cosine (\({\small\operatorname{arcosh}{x}}\)arcosh(x)) 
(function) [edit]
 
 computes the inverse hyperbolic tangent (\({\small\operatorname{artanh}{x}}\)artanh(x)) 
(function) [edit]
 
 
 
 nearest integer not greater in magnitude than the given value 
(function) [edit]
 
 nearest integer, rounding away from zero in halfway cases 
(function) [edit]
 
 nearest integer using current rounding mode with
exception if the result differs
(function) [edit]
 
 
 multiplies a number by FLT_RADIX  raised to a power 
(function) [edit]
 
 next representable floating-point value towards the given value 
(function) [edit]
 
 
 checks if the first floating-point argument is greater or equal than the second 
(function) [edit]
 
 checks if the first floating-point argument is less or equal than the second 
(function) [edit]
 
 checks if the first floating-point argument is less or greater than the second 
(function) [edit]
 
 
 
 
 
 indicates the overflow value for float, double and long double respectively 
(macro constant) [edit]
 
 evaluates to positive infinity or the value guaranteed to overflow a float 
(macro constant) [edit]
 
 defines the error handling mechanism used by the common mathematical functions 
(macro constant) [edit]
 
 
 
 
 
 
 
 
 
 
 
 (C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
(C++11)
Contents
[edit] Functions
Defined in header 
<cstdlib>  Defined in header 
<cinttypes>  Defined in header 
<cmath>  Basic operations
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)
(function) [edit]
Exponential functions
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)
(function) [edit]
Power functions
(C++11)(C++11)(C++11)
+y2
and \(\scriptsize{\sqrt{x^2+y^2+z^2}}\)√x2
+y2
+z2
(since C++17)
(function) [edit]
Trigonometric functions
Hyperbolic functions
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)
(function) [edit]
Error and gamma functions
Nearest integer floating point operations
(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
exception if the result differs
(function) [edit]
Floating point manipulation functions
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
(function) [edit]
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)
(function) [edit]
Classification and comparison
(C++11)
(function) [edit]
(C++11)
(function) [edit]
(C++11)
(function) [edit]
[edit] Types
Defined in header 
<cstdlib>  Defined in header 
<cinttypes>  Defined in header 
<cmath>  [edit] Macro constants
Defined in header 
<cmath>  (C++11)(C++11)
(macro constant) [edit]
(C++11)
(macro constant) [edit]
(C++11)(C++11)(C++11)
(macro constant) [edit]
Classification
[edit] Notes
| Feature-test macro | Value | Std | Feature | 
|---|---|---|---|
| __cpp_lib_constexpr_cmath | 202202L | (C++23) | Constexpr for FP environment agnostic mathematical functions in <cmath> and <cstdlib> | 
| 202306L | (C++26) | Constexpr for most mathematical functions in <cmath> | 
[edit] See also
C documentation  for Common mathematical functions