Current location - Training Enrollment Network - Mathematics courses - What does fabs mean in C language?
What does fabs mean in C language?
Fabs () is a library function in C language, which is used to find the absolute value of floating-point number X.

1, Description: C library function? Double fabs(double x), returns floating-point number x? Absolute value of.

2. declaration: declaration of fabs () function: double fabs (double x).

3. Function: This function returns the absolute value of floating-point number X.

4. Description: Calculates |x| and returns x when x is not negative, otherwise returns-x.

5. Example: Demonstrate the use of fabs () function.

6. Compile: Let's compile and run the above program, which will produce the following results:

Extended data:

Math.h, a mathematical function library, can generally be found in C programming, # include.

Math.h header file declares some commonly used mathematical operations, such as power, root and so on. There are many of these header files, which are stored in the installation directory of VC software. For example:

1, trigonometric function

Double); crime; sine

Double cos (double); cosine

Shuangtan (double); tangent

2. Inverse trigonometric function

double asin(double); The result is between [-PI/2, PI/2]

Double acos (double); The result is between [0, PI]

Double (double); Arctangent (principal value), the result is between [-PI/2, PI/2]

double atan2 (double,double); Arctangent (integer value), the result is between [-PI, PI]

3. Hyperbolic trigonometric functions

Double sinh (double);

Double cosh (double);

Double tanh (double);

4. Exponents and Logarithms

double frexp(double value,int * exp); This is a method to split a value into a fractional part f and an exponential part exp (base 2), and return the fractional part f, that is, f * 2 exp. Where the value of f is in the range of 0.5~ 1.0 or 0.

double ldexp(double x,int exp); This function is just the opposite of the frexp function above, and the return value is x * 2 exp.

double modf(double value,double * iptr); Split a value and return its fractional part, with iptr pointing to the integer part.

Double; Logarithm based on e

double log 10(double); Logarithm based on 10

Double power (double x, double y); Calculate the y power of x

Floating point powf (floating point x, floating point y); This function is the same as pow, except that the input and output are single-precision floating-point numbers.

Double exp (double); Find the power of natural number e

double sqrt(double); square root

5, rounding

Double ceiling (double); Rounds up and returns the smallest integer not less than x.

Double floor (double); Take the integer down and return the largest integer not greater than x, which is the Gaussian function [x]

6. Absolute value

int ABS(int I); Find the absolute value of an integer

Double wafer factory (double); Absolute value of realistic type

Double cab (complex structure Znum); Find the absolute value of a complex number

7. Standardized floating-point numbers

double frexp (double f,int * p); Standardized floating-point number, f = x * 2^p, f is known to find x, p (x is between [0.5, 1]).

double ldexp (double x,int p); Contrary to frexp, it is known that x and p find f.

8. Rounding and rounding

double modf (double,double *); Returns the integer part of a parameter through a pointer, and returns the decimal part.

double fmod (double,double); Returns the remainder of the division of two parameters.

9. Others

Double sea waves (double x, double y); Given the length of two right-angled sides of a right-angled triangle, find the length of the hypotenuse.

Double ldexp(double x, int exponent); Calculate x * (the exponential power of 2)

double poly(double x,int degree,double coeffs[]); Computational polynomial

Int matherr (structural abnormality * e); Mathematical error calculation processor

Source: C&C++Code Capsule

References:

Math.h-Baidu Encyclopedia