6.11 <math.h> Mathematical Functions
The header file math.h
consists of a macro and various functions
that calculate common mathematical operations. Error conditions may be handled with a
domain error or range error (see errno.h
).
A domain error occurs when the input argument is outside the domain over
which the function is defined. The error is reported by storing the value of
EDOM
in errno
and returning a particular value
defined for each function.
A range error occurs when the result is too large or too small to be represented in the
target precision. The error is reported by storing the value of ERANGE
in errno
and returning
HUGE_VAL
/HUGE_VALL
/HUGE_VALF
if
the (double
/long double
/float
) result
overflowed (return value was too large) or a zero if the result underflowed (return
value is too small).
Responses to special values, such as NaNs, zeros and infinities, may vary depending upon the function.