exp(3M) DG/UX 5.4.2 exp(3M)
NAME
exp, expf, cbrt, log, logf, log10, log10f, pow, powf, sqrt, sqrtf -
exponential, logarithm, power, square root functions
SYNOPSIS
cc [flag ...] file ... -lm [library ...]
#include <math.h>
double exp (double x);
float expf (float x);
double cbrt (double x);
double log (double x);
float logf (float x);
double log10 (double x);
float log10f (float x);
double pow (double x, double y);
float powf (float x, float y);
double sqrt (double x);
float sqrtf (float x);
DESCRIPTION
exp and expf return ex.
cbrt returns the cube root of x.
log and logf return the natural logarithm of x. The value of x must
be positive.
log10 and log10f return the base ten logarithm of x. The value of x
must be positive.
pow and powf return xy. If x is 0, y must be positive. If x is
negative, y must be an integer.
sqrt and sqrtf return the non-negative square root of x. The value
of x may not be negative.
DIAGNOSTICS
exp and expf return HUGE when the correct value would overflow, or 0
when the correct value would underflow, and set errno to ERANGE.
log, logf, log10, and log10f return -HUGE and set errno to EDOM when
x is non-positive. A message indicating DOMAIN error is printed on
Licensed material--property of copyright holder(s) 1
exp(3M) DG/UX 5.4.2 exp(3M)
standard error.
pow and powf return 0 and set errno to EDOM when x is 0 and y is non-
positive, or when x is negative and y is not an integer. In these
cases, a message indicating DOMAIN error is printed on standard
error. When the correct value for pow or powf would overflow or
underflow, these functions return ±HUGE or 0, respectively, and set
errno to ERANGE.
sqrt and sqrtf return 0 and set errno to EDOM when x is negative. A
message indicating DOMAIN error is printed on standard error.
Except when the -Xc compilation option is used, these error-handling
procedures may be changed with the function matherr. When the -Xa or
-Xc compilation options are used, HUGEVAL is returned instead of
HUGE and no error messages are printed. In these compilation modes,
pow and powf return 1, with no error, when both x and y are 0; when x
is 0 and y is negative, they return -HUGEVAL and set errno to EDOM.
Under -Xc, log and logf return -HUGEVAL and set errno to ERANGE when
x is 0. Under -Xc, sqrt and sqrtf return NaN when x is negative.
SEE ALSO
hypot(3M), matherr(3M), sinh(3M).
Licensed material--property of copyright holder(s) 2