C language Tan () function: tangent function
header file:
The tan () function is used to find the tangent of a given value, and its prototype is:
The "parameter" x is the given radian value.
Return value returns the tangent value of x.
Note that when compiling with GCC, please join-LM.
Take a look at the following code:
#include <math.h>
Main () {
Double answer = tan (0.5);
printf ("tan (0.5) =%f\n", answer);
}
Output results:
C language Tanh () function: hyperbola tangent function
header file:
Tanh () is used to find the hyperbolic tangent of a number, and its prototype is:
"Parameter" x is a point on the hyperbolic tangent.
Return value returns the hyperbolic tangent of x, with a value ranging from 1 to 1.
The hyperbolic tangent is defined as Sinh (x)/cosh (x), i.e.
Diagram of hyperbolic tangent curve:
Note that when compiling with GCC, please join-LM.
Take a look at the following code:
#include <math.h>
Main () {
Double answer = tanh (0.5);
printf ("tanh (0.5) =%f\n", answer);
}
Output results:
C Language Atan () function: To calculate the tangent value (in radians)
header file:
To define a function:
Function Description: Atan () is used to calculate the inverse tangent value of the parameter x, and then returns the result.
Return value: Returns the result of the calculation between-PI/2 and PI/2.
Note that when compiling with GCC, please join-LM.
Example
#include <math.h>
Main () {
double angle;
Angle = Atan (1);
printf ("angle =%f\n", angle);
}
Perform
C language atan2 () function: To calculate the tangent value (in radians)
header file:
To define a function:
Double atan2 (double y, double x);
Function Description: atan2 () is used to calculate the tangent value of the parameter y/x, and then returns the result.
Return value: Returns the result of the calculation between-PI/2 and PI/2.
Note that when compiling with GCC, please join-LM.
Example
#include <math.h>
Main () {
double angle;
Angle = atan2 (1, 2);
printf ("angle =%f\n", angle);
}
Perform