C mathematical operations are a group of functions in the standard library of the C programming language implementing basic mathematical functions. Most of the functions involve the use of floating point numbers. Different C standards provide different albeit backwards-compatible, sets of functions. C mathematical functions are inherited in C++.
Most of the mathematical functions are placed in math.h
header (cmath
header in C++). The functions that operate on integers, such as abs
, labs
, div
, and ldiv
, are instead specified in the stdlib.h
header (cstdlib
header in C++).
Any functions that operate on angles use radians as the unit of angle.
In C89, all functions accept only type double
for the floating-point arguments. In C99, this limitation was fixed by introducing new sets of functions with f
and l
suffixes that work on float
and long double
arguments respectively.
C99 adds several functions and types for fine-grained control of floating point computations. The additional functions and types are defined in fenv.h
header (cfenv
in C++).