Include:
Prototype: double log(double x);
double log10(double x);
Returns: a logarithm result if successful, or - HUGE_VAL if not.
errno: EDOM (if x < 0)
ERANGE (if x = 0)
See also: exp, matherr, pow
The log and log10 functions calculate the natural logarithm and base-10
logarithm of x, respectively.
Return Value
The log and log10 functions return the logarithm result. If x is negative,
both functions print a DOMAIN error message to stderr, return the value -
HUGE_VAL, and set errno to EDOM. If x is 0, both functions print a SING
error message to stderr, return the value -HUGE_VAL, and set errno to
ERANGE.
----- C 4.0 Difference -----
In Version 4.0 of the Microsoft C Run-Time Library, both log and log10 set
errno to EDOM whether x was 0 or a negative value.
Error handling can be modified by using the matherr routine.