Department of Engineering

IT Services

Predefined functions

You need to have the #include <math> directive at the top of your program to use these. All parameters and return values are of type double.

Function    Description
sqrt(x) square root
sin(x) trigonometric sine of x (in radians)
cos(x) trigonometric cosine of x (in radians)
tan(x) trigonometric tangent of x (in radians)
exp(x) exponential function
log(x) natural logarithm of x (base e)
log10(x) logarithm of x to base 10
fabs(x) absolute value (unsigned)
rint(x) round x to nearest integer
pow(x,y) x raised to power y