Mathematical Functions In C language
FUNCTIONS In c Language
A function is a self-contained block of code that performs a particular task. Once a function has been designed and packed, it can be treated as a ’black box’ that takes some data from the main program and returns a value. The inner details of operation are invisible to the rest of the program. All that program knows about a function is: what goes in and what comes out. Every program can be designed using a collection of these black boxes known as functions.
The Mathematical Functions: The mathematical functions are divided into following categories:
(1) Trigonometric functions
(2) Hyperbolic functions.
(3) Exponential and logarithmic functions.
(4) Miscellaneous functions.
All the math functions require the header file <cmath> or <math.h> 1)Trigonometric Functions:
(i) cos(): The cos() function returns the cosine of the argument passed to it. The value of the argument must be in radians.
Syntax: float cos(float);
double cos(double);
long double cos(long double);
(ii) sin(): The sin() function returns the sine of the argument passed to it. The value of argument must be in radians.
Syntax: float sin (float);
double sin (double);
long double sin (long double);
(iii) tan(): The tan() function returns the tangent of the argument passed to it. The value of argument must be in radians.
Syntax: float tan (float);
double tan (double);
long double tan (long double);
(iv) acos(): The acos() function returns the arc cosine of the argumet passed to it. The argument to acos() must be in the range -1 to 1; Otherwise a domam error will occur.
Syntax: float acos (float);
double acos (double);
long double acos (long double);
(v) asin: The asin() function returns the arc sine of the argument passed to it. The argument to asin() must be in the range of -1 to 1; otherwise a domain error will occur.
Syntax: float asin (float);
double asin (double);
long double asin (long double);
(vi) atan(): The atan() function returns the arc tangent of the argument passed to it.
Syntax: float atan (float);
double atan (double);
long double atan (long double);
(Vii)atan2(): The atan2() function returns the arc tangent of y/x. It uses the signs of its arguments to compute the quadrant of the return value. Syntax:
float atan2 (float, float);
double atan2 (double, double);
long double atan2 (long double, long double);
No related posts
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment