C Math Functions
Following is a list of some useful C library functions.
The Absolute Value Functions
abs(some integer)
labs(some long int)
int x = abs(-5);
long int y = abs(-5);
Some other Math Functions
(found in math.h)
double exp(double x);
exponential of x
double log(double x);
natural logarithm of x
double log10(double x);
base-10 logarithm of x
double pow(double x, double y);
x raised to power y
double sqrt(double x);
square root of x
double ceil(double x);
smallest integer not less than x
double floor(double x);
largest integer not greater than x
double sin(double x);
sine of x
double cos(double x);
cosine of x
double tan(double x);
tangent of x
double fabs(double x);
absolute value of x
// found in stdlib.h
int abs(int n);
absolute value of n
long labs(long n);
absolute value of n
int rand(void);
Returns pseudo-random number in range 0 to RAND_MAX.
void srand(unsigned int seed);
Uses seed as seed for new sequence of pseudo-random numbers. Initial seed is 1.
RAND_MAX
Maximum value returned by rand().