Standard C Math
abs | absolute value |
acos | arc cosine |
asin | arc sine |
atan | arc tangent |
atan2 | arc tangent, using signs to determine quadrants |
ceil | the smallest integer not less than a certain value |
cos | cosine |
cosh | hyperbolic cosine |
div | returns the quotient and remainder of a division |
exp | returns āeā raised to a given power |
fabs | absolute value for floating-point numbers |
floor | returns the largest integer not greater than a given value |
fmod | returns the remainder of a division |
frexp | decomposes a number into scientific notation |
labs | absolute value for long integers |
ldexp | computes a number in scientific notation |
ldiv | returns the quotient and remainder of a division, in long integer form |
log | natural logarithm (to base e) |
log10 | common logarithm (to base 10) |
modf | decomposes a number into integer and fractional parts |
pow | returns a given number raised to another number |
sin | sine |
sinh | hyperbolic sine |
sqrt | square root |
tan | tangent |
tanh | hyperbolic tangent |
Compiling with gcc
In order to use some of the above functions, certain versions of the gcc compiler require the math library to be explicitly linked in using the -lm
command-line option.