All math.h functions handle errors similarly.
In the case that the argument passed to the function exceeds
the range of that function, then the variable
is set to
EDOM. The value that the function
returns is implementation specific.
In the case that the value being returned is too large to be
represented in a double, then the function returns the macro
HUGE_VAL, and sets the variable
ERANGE to represent an
overflow. If the value is too small to be represented in a
double, then the function returns zero. In this case whether or
errno is set to
is implementation specific.
ERANGE are defined in the errno.h header.
Note that in all cases when it is stated that there is no
range limit, it is implied that the value is limited by the
minimum and maximum values of type double.