math.h

The math.h header file contains function declarations for all the floating-point math functions.

No feature test macro required.

Special Behavior for C++

For C++ applications, each of the base functions in the preceding list is also overloaded for float, double, and long double. For example:
  • float sqrt(float)
  • double sqrt(double)
  • long double sqrt(long double)

_XOPEN_SOURCE

_XOPEN_SOURCE_EXTENDED 1

The header file includes declarations for the built-in functions abs() and fabs(). For information about built-in functions, see Built-in Functions.

The math.h header file declares the macro HUGE_VAL, which expands to a positive double expression.

For all mathematical functions, a domain error occurs when an input argument is outside the range of values allowed for that function. If a domain error occurs, errno is set to the value of EDOM.

A range error occurs if the result of the function cannot be represented in a double value. If the magnitude of the result is too large (overflow), the function returns the positive or negative value of the macro HUGE_VAL, and sets errno to ERANGE. If the result is too small (underflow), the function returns a value of 0.