Go to the previous, next section.

Exponentiation and Logarithms

Function: double exp (double x)

The exp function returns the value of e (the base of natural logarithms) raised to power x.

The function fails, and sets errno to ERANGE, if the magnitude of the result is too large to be representable.

Function: double log (double x)

This function returns the natural logarithm of x. exp (log (x)) equals x, exactly in mathematics and approximately in C.

The following errno error conditions are defined for this function:

EDOM
The argument x is negative. The log function is defined mathematically to return a real result only on positive arguments.

ERANGE
The argument is zero. The log of zero is not defined.

Function: double log10 (double x)

This function returns the base-10 logarithm of x. Except for the different base, it is similar to the log function. In fact, log10 (x) equals log (x) / log (10).

Function: double pow (double base, double power)

This is a general exponentiation function, returning base raised to power.

The following errno error conditions are defined for this function:

EDOM
The argument base is negative and power is not an integral value. Mathematically, the result would be a complex number in this case.

ERANGE
An underflow or overflow condition was detected in the result.

Function: double sqrt (double x)

This function returns the nonnegative square root of x.

The sqrt function fails, and sets errno to EDOM, if x is negative. Mathematically, the square root would be a complex number.

Function: double cbrt (double x)

This function returns the cube root of x. This function cannot fail; every representable real value has a representable real cube root.

Function: double hypot (double x, double y)

The hypot function returns sqrt (x*x + y*y). (This is the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin.) See also the function cabs in section Absolute Value.

Function: double expm1 (double x)

This function returns a value equivalent to exp (x) - 1. It is computed in a way that is accurate even if the value of x is near zero--a case where exp (x) - 1 would be inaccurate due to subtraction of two numbers that are nearly equal.

Function: double log1p (double x)

This function returns a value equivalent to log (1 + x). It is computed in a way that is accurate even if the value of x is near zero.

Go to the previous, next section.