Skip to content

<math.h>

Floating-point constants, classification macros and libm declarations.

#include <math.h>

Constants

Name Value Description
HUGE_VAL (__builtin_huge_val()) Overflow result for double.
HUGE_VALF (__builtin_huge_valf()) Overflow result for float.
HUGE_VALL (__builtin_huge_vall()) Overflow result for long double.
INFINITY (__builtin_inff()) Positive infinity, as a float.
NAN (__builtin_nanf("")) A quiet NaN, as a float.
isnan(x) Non-zero if x is a NaN.
isinf(x) 1 for +infinity, -1 for -infinity, 0 otherwise.
isfinite(x) Non-zero if x is neither infinite nor a NaN.
signbit(x) Non-zero if x has its sign bit set.

Functions

acos

double acos(double x);

Arc cosine of x, in radians.

Parameter Direction Description
x in Argument.

Returns: The result.

asin

double asin(double x);

Arc sine of x, in radians.

Parameter Direction Description
x in Argument.

Returns: The result.

atan

double atan(double x);

Arc tangent of x, in radians.

Parameter Direction Description
x in Argument.

Returns: The result.

atan2

double atan2(double y, double x);

Arc tangent of y / x, using both signs to pick the quadrant.

Parameter Direction Description
y in Argument.
x in Argument.

Returns: The result.

ceil

double ceil(double x);

Smallest integer value not below x.

Parameter Direction Description
x in Argument.

Returns: The result.

cos

double cos(double x);

Cosine of x radians.

Parameter Direction Description
x in Argument.

Returns: The result.

cosh

double cosh(double x);

Hyperbolic cosine of x.

Parameter Direction Description
x in Argument.

Returns: The result.

exp

double exp(double x);

e raised to x.

Parameter Direction Description
x in Argument.

Returns: The result.

floor

double floor(double x);

Largest integer value not above x.

Parameter Direction Description
x in Argument.

Returns: The result.

fmod

double fmod(double x, double y);

Remainder of x / y, with the sign of x.

Parameter Direction Description
x in Argument.
y in Argument.

Returns: The result.

frexp

double frexp(double x, int *exponent);

Splits x into a fraction in [0.5, 1) and a power of two.

Parameter Direction Description
x in Argument.
exponent out Receives the power of two.

Returns: The fraction.

ldexp

double ldexp(double x, int exponent);

x times 2 raised to exponent.

Parameter Direction Description
x in Argument.
exponent in Power of two.

Returns: The result.

log

double log(double x);

Natural logarithm of x.

Parameter Direction Description
x in Argument.

Returns: The result.

log10

double log10(double x);

Base-10 logarithm of x.

Parameter Direction Description
x in Argument.

Returns: The result.

modf

double modf(double x, double *ipart);

Splits x into integer and fractional parts with the sign of x.

Parameter Direction Description
x in Argument.
ipart out Receives the integer part.

Returns: The fractional part.

pow

double pow(double x, double y);

x raised to y.

Parameter Direction Description
x in Argument.
y in Argument.

Returns: The result.

sin

double sin(double x);

Sine of x radians.

Parameter Direction Description
x in Argument.

Returns: The result.

sinh

double sinh(double x);

Hyperbolic sine of x.

Parameter Direction Description
x in Argument.

Returns: The result.

sqrt

double sqrt(double x);

Square root of x.

Parameter Direction Description
x in Argument.

Returns: The result.

tan

double tan(double x);

Tangent of x radians.

Parameter Direction Description
x in Argument.

Returns: The result.

tanh

double tanh(double x);

Hyperbolic tangent of x.

Parameter Direction Description
x in Argument.

Returns: The result.

acosl

long double acosl(long double x);

Arc cosine of x, in radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

asinl

long double asinl(long double x);

Arc sine of x, in radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

atanl

long double atanl(long double x);

Arc tangent of x, in radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

atan2l

long double atan2l(long double y, long double x);

Arc tangent of y / x, using both signs to pick the quadrant.

(long double)

Parameter Direction Description
y in Argument.
x in Argument.

Returns: The result.

ceill

long double ceill(long double x);

Smallest integer value not below x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

cosl

long double cosl(long double x);

Cosine of x radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

coshl

long double coshl(long double x);

Hyperbolic cosine of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

expl

long double expl(long double x);

e raised to x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

floorl

long double floorl(long double x);

Largest integer value not above x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

fmodl

long double fmodl(long double x, long double y);

Remainder of x / y, with the sign of x.

(long double)

Parameter Direction Description
x in Argument.
y in Argument.

Returns: The result.

frexpl

long double frexpl(long double x, int *exponent);

Splits x into a fraction in [0.5, 1) and a power of two.

(long double)

Parameter Direction Description
x in Argument.
exponent out Receives the power of two.

Returns: The fraction.

ldexpl

long double ldexpl(long double x, int exponent);

x times 2 raised to exponent.

(long double)

Parameter Direction Description
x in Argument.
exponent in Power of two.

Returns: The result.

logl

long double logl(long double x);

Natural logarithm of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

log10l

long double log10l(long double x);

Base-10 logarithm of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

modfl

long double modfl(long double x, long double *ipart);

Splits x into integer and fractional parts with the sign of x.

(long double)

Parameter Direction Description
x in Argument.
ipart out Receives the integer part.

Returns: The fractional part.

powl

long double powl(long double x, long double y);

x raised to y.

(long double)

Parameter Direction Description
x in Argument.
y in Argument.

Returns: The result.

sinl

long double sinl(long double x);

Sine of x radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

sinhl

long double sinhl(long double x);

Hyperbolic sine of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

sqrtl

long double sqrtl(long double x);

Square root of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

tanl

long double tanl(long double x);

Tangent of x radians.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.

tanhl

long double tanhl(long double x);

Hyperbolic tangent of x.

(long double)

Parameter Direction Description
x in Argument.

Returns: The result.