math library
#include <math.h>
When compiling on a unix system like esus, you must not only include math.h,
you must also link in the library during compilation using the -lm switch.
For example: cc myprog.c -lm
All functions take double parameters and return double values.
- double acos(double x);
computes the arc cosine of x with x between [-1, 1]
returns acos in the range [0, pi] radians
- double asin(double x);
computes the arc sine of x with x between [-1, 1]
returns asin in the range [-pi/2, pi/2] radians
- double atan(double x);
computes the arc tangent of x
returns atan in the range [-pi/2, pi/2] radians
- double atan2(double x, double y);
computes the arc tangent of y/x
returns atan2 in the range [-pi, pi] radians
- double cos(double x);
computes the cosine of x measured in radians
returns cosine
- double sin(double x);
computes the sine of x measured in radians
returns sine
- double tan(double x);
computes the tangent of x measured in radians
returns tangent
- double cosh(double x);
computes the hyperbolic cosine of x
returns hyperbolic cosine
- double sinh(double x);
computes the hyperbolic sine of x
returns hyperbolic sine
- double tanh(double x);
computes the hyperbolic tangent of x
returns hyperbolic tangent
- double exp(double x);
computes the exponential function of x (computes e to the x)
returns exponential value
- double frexp(double value, int *exp);
breaks a floating point number into a normalized fraction and an
integral power of 2. It stores the integer in the integer object
pointed to by exp.
returns the value of x such that x is a double with magnitude in
the interval [1/2, 1] or zero and value equals x times 2 raised to
the power *exp. If the value is zero, both parts are zero.
- double ldexp(double x, int exp);
mulitplies a floating point number by an integral power of 2.
returns the value of x times 2 raised to the power exp
- double log(double x);
determines the natural logarithm of x if x > 0
returns the natural logarithm of x
- more to come