Math Functions

C++ compilers offer basic mathematical functions.

 Function Prototype Purpose abs(x) int abs(int x); returns the absolute value of an integer. fabs(x) double fabs(double x); returns the absolute value of a floating point number ceil(x) double ceil(double x); rounds up to a whole number cout<=0) fmod(x,y) double fmod(double x,          double y); returns floating point remainder of x/y with same sign as x.  Y cannot be zero.  Because the modulus operator(%) works only with integers, this function is used to find the remainder of floating point number division.


 NOTE: The trigonometric functions work with angles in radians rather than degrees.

All of the trigonometric functions take double arguments and have double return types.

 cos(x) cosine of x sin(x) sine of x tan(x) tangent of x acos(x) arc cosine x asin(x) arc sine of x atan(x) arc tangent x cosh(x) hyperbolic cosine of x sinh(x) hyperbolic sine of x tanh(x) hyperbolic tangent of x exp(x) exponential function log(x) natural logarithm log10(x) base 10 logarithm