Math Library Functions in C++

C++ provides a large set of mathematical functions which are stated below:

Function Description
double sin(double) This function takes angle (in radian) as an argument and returns its sine value that could be verified using sine curve.
double cos(double) This function takes angle (in radians) as an argument and returns its cosine value that could be verified using cosine curve.
double tan(double) This function takes angle (in radians) as an argument and returns its tangent value. This could also be verified using Trigonometry as Tan(x) = Sin(x)/Cos(x).
double sqrt(double) This function takes a number as an argument and returns its square root value. The number can not be a negative value.
int abs(int) This function takes an integer number as an argument and returns its absolute value. It means the output will always be positive regardless of the sign of the input.
double pow(double, double) This function takes one argument as base and another as exponent.
double hypot(double, double) This function requires two sides of the right-angled triangle to give output as its hypotenuse.
double floor(double) This functions returns the integer value lesser or equal to the argument passed in the function.
double fabs(double) This function returns the absolute value of any number.
double acos(double) This function returns the arc cosine of the argument. The argument to acos() must be in the range -1 to 1; otherwise, a domain error occurs.
double asin(double) This function returns the arc sine of the argument. The argument to asin() must be in the range -1 to 1; otherwise, a domain error occurs.
double atan(double) This function returns the arc tangent of arg.
double atan2(double, double) This function returns the arc tangent of (double a)/(double b).
double ceil(double) This function returns the smallest integer as double not less than the argument provided.
double cosh(double) This function returns the hyperbolic cosine of the argument provided. The value of the argument provided must be in radians.
double tanh(double) This function returns the hyperbolic tangent of the argument provided. The value of the argument provided must be in radians.
double log(double) This function takes a number and returns the natural log of that number.
double exp(double) This function returns the value of e = 2.718 raised to the given number.

C++ Mathematical Functions

C++ being a superset of C, supports a large number of useful mathematical functions. These functions are available in standard C++ to support various mathematical calculations.

Instead of focusing on implementation, these functions can be directly used to simplify code and programs. In order to use these functions you need to include a header file- <math.h> or <cmath>.

Similar Reads

Math Library Functions in C++

C++ provides a large set of mathematical functions which are stated below:...

Example of C++ Mathematical Functions

C++ program to illustrate some of the above-mentioned functions:...