Current location - Education and Training Encyclopedia - Educational institution - When will math.h be used in C language?
When will math.h be used in C language?
If the program is to solve mathematical problems, such as finding the square pow(x, 2); Or find the square root sqrt (x); Or find the absolute value fabs (x); Find absolute value function, fabs trigonometric function, exponential function and other mathematical functions.

This function can be called directly if it is declared in math.h, so it is used.

Extended data:

Math.h usually appears in C and C++ programming, # include

Matters needing attention

1, there is no ready-made cot trigonometric function, which can be realized by tan(PI/2-x).

2. Double atan2 (double Y, double X); The value range is between (PI, PI); This is an uncommon function, which is mainly used to return the arctangent value of y/x.

3. It should be emphasized that the parameters of type 1-3 are all for values expressed in radians, not angles.

4. For the general logarithmic solution, we can consider using mathematical logarithmic transformation to realize it.

Baidu encyclopedia -math.h