Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

C Standard Library – <math.h>


May 11, 2021 C


Table of contents


C Standard Library - slt;math.h>

Brief introduction

The math.h header file defines various mathematical functions and a macro. All available features in this library come with a double-type parameter and return double-type results.

Library macros

Here is the only macro defined in this library:

Serial number Macro & Description
1 HUGE_VAL

When the result of the function cannot be represented as a floating point number.If the result is too great to not indicate, the function sets errno to represent the range error and return a specific value named by the macro huge_val or its negative (- huge_val).

If the result is too small, a zero value is returned.In this case, Error may be set to ERANGE, or may not be set to ERANGE.

The library function

The functions defined in the header file math.h are listed below:

Serial number Function & Description
1 double acos(double x)
Returns the anti-resting string of X represented by radians.
2 double asin(double x)
Returns an anhanctone of X represented by radians.
3 double atan(double x)
Returns an interpretation of X in the arc.
4 double atan2(double y, double x)
Returns anyway to Y / X represented by radians.The symbol of the value of Y and X determines the correct quadrant.
5 double cos(double x)
Returns the cosine of the arc angle x.
6 double cosh(double x)
Returns the twin cosine of x.
7 double sin(double x)
Returns the sinusoidal arc angle x.
8 double sinh(double x)
Returns the double sine of the X.
9 double tanh(double x)
Returns the dual song of x.
10 double exp(double x)
Returns the value of the X power.
11 double frexp(double x, int *exponent)
Decompose the floating point X X into the mantissa and index.The return value is the mantissa and stores the index in Exponent.The resulting value is x = mantissa * 2 ^ EXPONENT.
12 double ldexp(double x, int exponent)
Returns x multiplying the EXPONENT power by 2.
13 double log(double x)
Returns the natural logarithm of x (the alignment of the base E).
14 double log10(double x)
Returns the common logarithm (logarithm of the base 10).
15 double modf(double x, double *integer)
The return value is a fractional portion (the part behind the decimal point) and sets Integer as an integer portion.
16 double pow(double x, double y)
Returns the Y power of x.
17 double sqrt(double x)
Returns the square root of x.
18 double ceil(double x)
Returns the smallest integer value greater than or equal to X.
19 double fabs(double x)
Returns the absolute value of X.
20 double floor(double x)
Returns the maximum integer value of less than or equal to X.
21 double fmod(double x, double y)
Returns X divided by the remainder of Y.