
C Math Functions
Photo Credit to CodeToFun
What is Math Functions in C?
Math functions in C refer to a set of standard library functions provided by the <math.h> header.
These functions enable you to perform various mathematical operations and calculations in your C programs.
The <math.h> header provides functions for common mathematical operations such as trigonometry, exponential and logarithmic calculations, rounding, absolute value, square root, and more. These functions are implemented to handle floating-point numbers and provide accurate results based on the IEEE 754 floating-point standard.
List of C Math Functions
Some of the commonly used math functions in C include:
| Functions | Explanation |
|---|---|
| abs() | Returns the absolute value of x. |
| acos() | Returns the arc-cosine of x. |
| acosh() | Returns the hyperbolic arc-cosine of x. |
| asin() | Returns the arc-sine of x. |
| asinh() | Returns the hyperbolic arc-sine of x. |
| atan2() | Returns the angle in the plane between the positive x-axis and the ray from (0, 0) to the point (x, y), for atan2(y, x). |
| atan() | Returns the arc-tangent (in radians) of x. |
| atanh() | Returns the hyperbolic arc-tangent of x. |
| cbrt() | Returns the cube root of x. |
| ceil() | Returns a number representing the nearest integer which is greater than or equal to x. |
| cos() | Returns the cosine of x. |
| cosh() | Returns the hyperbolic cosine of x. |
| exp() | Returns the value of Ex |
| fabs() | Returns the absolute value of x. |
| floor() | Returns a number representing the nearest integer which is less than or equal to x. |
| fmod() | Returns the remainder of x divided by y. |
| frexp() | Returns the mantissa and the exponent of x. |
| hypot() | Returns the square root of the sum of squares of its arguments. |
| ldexp() | Returns x multiplied by 2 raised to the power of exponent. |
| log10() | Returns the base 10 logarithm of x. |
| log() | Returns the natural logarithm (base E) of x |
| modf() | Breaks the given argument into two parts, one is integer and the other one is fractional. |
| pow() | Returns a number representing the given base taken to the power of the given exponent. |
| round() | Returns the value of a number rounded to the nearest integer. |
| sin() | Returns the sine of x. |
| sinh() | Returns the hyperbolic sine of x. |
| sqrt() | Returns the square root of x. |
| tan() | Returns the tangent of x. |
| tanh() | Returns the hyperbolic tangent of x. |
| trunc() | Returns the integer part of the number x, removing any fractional digits. |
The math functions in C provide powerful capabilities to perform advanced mathematical calculations and are widely used in various applications requiring numerical computations.
👨💻 Join our Community:
Author

For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee












If you have any doubts regarding this article (C Math Functions) please comment here. I will help you immediately.