Skip to content
C math.h
Functions
- acos(x)
- Computes the arccosine (inverse cosine) of x, returning the angle in radians.
- acosh(x)
- Computes the inverse hyperbolic cosine of x.
- asin(x)
- Computes the arcsine (inverse sine) of x, returning the angle in radians.
- asinh(x)
- Computes the inverse hyperbolic sine of x.
- atan(x)
- Computes the arctangent (inverse tangent) of x, returning a value in the range -π/2 to π/2 radians.
- atan2(y, x)
- Computes the angle θ in radians from the rectangular coordinates (x, y) to polar coordinates (r, θ).
- atanh(x)
- Computes the inverse hyperbolic tangent of x.
- cbrt(x)
- Computes the cube root of x.
- ceil(x)
- Returns the smallest integer greater than or equal to x.
- copysign(x, y)
- Returns x with the sign of y.
- cos(x)
- Computes the cosine of x, where x is in radians.
- cosh(x)
- Computes the hyperbolic cosine of x.
- exp(x)
- Computes the exponential function ex.
- exp2(x)
- Computes 2x.
- expm1(x)
- Computes ex – 1.
- erf(x)
- Computes the error function of x.
- erfc(x)
- Computes the complementary error function of x.
- fabs(x)
- Computes the absolute value of x.
- fdim(x, y)
- Computes the positive difference between x and y.
- floor(x)
- Returns the largest integer less than or equal to x.
- fma(x, y, z)
- Computes x*y + z with reduced rounding error.
- fmax(x, y)
- Returns the larger of x and y.
- fmin(x, y)
- Returns the smaller of x and y.
- fmod(x, y)
- Computes the remainder of x/y as a floating-point value.
- frexp(x, y)
- Decomposes x into a normalized fraction and an exponent, such that x = m * 2^n, returning the fraction m (a value between 0.5 and 1.0) and storing the exponent n at the memory location pointed to by y.
- hypot(x, y)
- Computes the Euclidean norm sqrt(x² + y²) without overflow or underflow.
- ilogb(x)
- Returns the exponent of the floating-point representation of x, effectively computing the integer part of the base-2 logarithm of x.
- ldexp(x, y)
- Computes x * 2^y, effectively scaling x by a power of two, commonly used in floating-point arithmetic.
- lgamma(x)
- Computes the natural logarithm of the absolute value of the gamma function of x, useful in statistical calculations.
- llrint(x)
- Rounds x to the nearest integer using the current rounding mode and returns the result as a long long integer.
- llround(x)
- Rounds x to the nearest integer, following the round-half-away-from-zero rule, and returns the result as a long long integer.
- log(x)
- Computes the natural logarithm of x (base e).
- log10(x)
- Computes the base 10 logarithm of x.
- log1p(x)
- Computes the natural logarithm of (1 + x), providing accurate results for small values of x to avoid precision loss.
- log2(x)
- Computes the base 2 logarithm of x.
- logb(x)
- Returns the exponent of the floating-point representation of the absolute value of x, effectively computing the base-2 logarithm of x.
- lrint(x)
- Rounds x to the nearest integer using the current rounding mode and returns the result as a long integer.
- lround(x)
- Rounds x to the nearest integer, following the round-half-away-from-zero rule, and returns the result as a long integer.
- modf(x, y)
- Splits x into its integer and fractional parts, returning the fractional part and storing the integer part in the memory location pointed to by y.
- nan(s)
- Returns a NaN (Not a Number) value.
- nearbyint(x)
- Rounds x to the nearest integer without raising floating-point exceptions, following the current rounding mode.
- nextafter(x, y)
- Returns the next representable floating-point value after x in the direction of y, considering machine precision.
- nexttoward(x, y)
- Returns the next representable floating-point value after x toward y, using extended precision if available.
- pow(x, y)
- Computes x raised to the power of y.
- remainder(x, y)
- Computes the remainder of x/y rounded to the nearest integer.
- remquo(x, y, z)
- Computes the remainder of x divided by y, rounding the quotient to the nearest integer, and stores the quotient at the memory location pointed to by z.
- rint(x)
- Rounds x to the nearest integer according to the current rounding mode, without raising floating-point exceptions.
- round(x)
- Rounds x to the nearest integer, following the round-half-away-from-zero rule.
- scalbln(x, y)
- Computes x multiplied by R raised to the power of y (typically R = 2), where y is a long integer.
- scalbn(x, y)
- Computes x multiplied by R raised to the power of y (typically R = 2), where y is an integer.
- sin(x)
- Computes the sine of x, where x is in radians.
- sinh(x)
- Computes the hyperbolic sine of x.
- sqrt(x)
- Computes the square root of x.
- tan(x)
- Computes the tangent of x, where x is in radians.
- tanh(x)
- Computes the hyperbolic tangent of x.
- tgamma(x)
- Computes the gamma function of x.
- trunc(x)
- Returns the integer part of x, truncating the fractional component.