Mathematical Functions
There are more than twenty mathematical functions declared in <math.h>
; here are some of the more frequently used. Each takes one or two double arguments and returns a double.
Function | Description |
---|---|
sin(x) | sine of x, x in radians |
cos(x) | cosine of x, x in radians |
atan2(y, x) | arctangent of y/x, in radians |
exp(x) | exponential function of x, base e |
log(x) | natural (base e) logarithm of x (x > 0) |
log10(x) | common (base 10) logarithm of x (x > 0) |
pow(x, y) | x raised to the power of y |
sqrt(x) | square root of x (x > 0) |
fabs(x) | absolute value of x |