Math

#include <cmath>            // Include cmath (std namespace)

pow(x, y);         // x to the power y
sqrt(x);           // square root of x
ceil(x);           // round up to int
floor(x);          // round down to int
fabs(x);           // absolute value
fmod(x, y);        // x mod y


exp(x); log(x); log10(x);   // e to the x, log base e, log base 10
sin(x); cos(x); tan(x);     // Trig functions, x (double) is in radians
asin(x); acos(x); atan(x);  // Inverses
atan2(y, x);                // atan(y/x)
sinh(x); cosh(x); tanh(x);  // Hyperbolic sin, cos, tan functions

Last updated