EXP(3M) SysV EXP(3M)
NAME
exp, log, log10, pow, sqrt - exponential, logarithm, power, square root
functions
SYNOPSIS
#include <math.h>
double exp (x)
double x;
double log (x)
double x;
double log10 (x)
double x;
double pow (x, y)
double x, y;
double sqrt (x)
double x;
DESCRIPTION
The exp function computes the exponential function of x.
The log function computes the natural logarithm of x.
The log10 function computes the base 10 logarithm of x.
The pow function computes the value of x raised to the power of y. If x
is negative, y must be an integral value. If x is 0 (zero), y must be
nonnegative. The pow(x,0.0) function call returns 1.0 for all x.
sqrt returns the non-negative square root of x. The value of x may not
be negative.
DIAGNOSTICS
Upon successful completion, exp returns the value of the exponential
function of x. If the correct value would overflow, the exp function
returns HUGE_VAL and sets errno to [ERANGE]. If the correct value would
underflow, the exp function returns zero and sets errno to [ERANGE]. If
x is NaN, NaN is returned.
log and log10 return -HUGE_VAL and set errno to [EDOM] when x is non-
positive. If x is NaN, NaN is returned and errno may be set to [EDOM].
The pow function returns the value of x raised to the power of y. pow
returns 0 and sets errno to EDOM when x is 0 and y is non-positive, or
when x is negative and y is not an integer. When the correct value for
pow would overflow or underflow, pow returns _HUGE_VAL or 0 respectively,
and sets errno to ERANGE.
If x or y is NaN, NaN is returned and errno may be set to [EDOM].
sqrt returns 0 and sets errno to EDOM when x is negative. If x is NaN,
NaN is returned and errno may be set to [EDOM].
These error-handling procedures may be changed with the function
matherr(3M).
SEE ALSO
hypot(3M), matherr(3M), sinh(3M).
NOTES
When you link your program to /usr/lib/crt0.o or to
/usr/apollo/lib/svid/crt0.o, these functions print a message on the
standard error output upon error:
+ log and log10 print a message indicating DOMAIN error (or SING error
when x is 0) when x is non-positive.
+ pow prints a message indicating DOMAIN error when x is 0 and y is
non-positive, or when x is negative and y is not an integer.
+ sqrt prints a message indicating DOMAIN error when x is negative.