Easy Tutorial
❮ C Function Ungetc C Function Isspace ❯

C Standard Library - <math.h>

Introduction

The math.h header file defines various mathematical functions and a macro. All the functions available in this library take a double type argument and return a double type result.

Library Macros

Below is the only macro defined in this library:

No. Macro & Description
1 HUGE_VAL <br> When the result of a function cannot be represented as a floating-point number. If the result is too large to be represented, the function sets errno to ERANGE to indicate a range error and returns a very large value named by the macro HUGE_VAL or its negation (- HUGE_VAL). If the result is too small, it returns a zero value. In this case, errno may be set to ERANGE, or it may not be set to ERANGE.

Library Functions

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

No. Function & Description
1 double acos(double x) <br> Returns the arc cosine of x in radians.
2 double asin(double x) <br> Returns the arc sine of x in radians.
3 double atan(double x) <br> Returns the arc tangent of x in radians.
4 double atan2(double y, double x) <br> Returns the arc tangent of y/x in radians. The signs of y and x determine the correct quadrant.
5 double cos(double x) <br> Returns the cosine of the angle x in radians.
6 double cosh(double x) <br> Returns the hyperbolic cosine of x.
7 double sin(double x) <br> Returns the sine of the angle x in radians.
8 double sinh(double x) <br> Returns the hyperbolic sine of x.
9 double tanh(double x) <br> Returns the hyperbolic tangent of x.
10 double exp(double x) <br> Returns the value of e raised to the xth power.
11 double frexp(double x, int *exponent) <br> Breaks the floating-point number x into its mantissa and exponent. The return value is the mantissa, and the exponent is stored in exponent. The resulting value is x = mantissa * 2 ^ exponent.
12 double ldexp(double x, int exponent) <br> Returns x multiplied by 2 raised to the power of exponent.
13 double log(double x) <br> Returns the natural logarithm (base-e logarithm) of x.
14 double log10(double x) <br> Returns the common logarithm (base-10 logarithm) of x.
15 double modf(double x, double *integer) <br> Returns the fractional part of x, and sets integer to the integer part.
16 double pow(double x, double y) <br> Returns x raised to the power of y.
17 double sqrt(double x) <br> Returns the square root of x.
18 double ceil(double x) <br> Returns the smallest integer value greater than or equal to x.
19 double fabs(double x) <br> Returns the absolute value of x.
20 double floor(double x) <br> Returns the largest integer value less than or equal to x.
21 double fmod(double x, double y) <br> Returns the remainder of x divided by y.
❮ C Function Ungetc C Function Isspace ❯