EXP(3) BSD Programmer's Manual EXP(3)NAME
exp, expf, expm1, expm1f, log, logf, log10, log10f, log1p, log1pf, pow,
powf - exponential, logarithm, power functions
SYNOPSIS
#include <math.h>
double
exp(double x);
float
expf(float x);
double
expm1(double x);
float
expm1f(float x);
double
log(double x);
float
logf(float x);
double
log10(double x);
float
log10f(float x);
double
log1p(double x);
float
log1pf(float x);
double
pow(double x, double y);
float
powf(float x, float y);
DESCRIPTION
The exp() and the expf() functions compute the exponential value of the
given argument x.
The expm1() and the expm1f() functions compute the value exp(x)-1 accu-
rately even for tiny argument x.
The log() and the logf() functions compute the value of the natural loga-
rithm of argument x.
The log10() and the log10f() functions compute the value of the logarithm
of argument x to base 10.
The log1p() and the log1pf() functions compute the value of log(1+x) ac-
curately even for tiny argument x.
The pow() and the powf() functions compute the value of x to the exponent
y.
For a discussion of error reporting, see math(3).
ERRORS
If the result of exp() or expf() would overflow or underflow, then:
_IEEE_ The return value is +Inf or 0, respectively.
_POSIX_ Same as _IEEE_, but errno is also set to ERANGE.
_XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0.
The exception type is OVERFLOW or UNDERFLOW, respectively.
_SVID_ Same as _XOPEN_, but the return value is MAXFLOAT or 0, respec-
tively.
For log(), logf(), log10() or log10f(), if x = 0 then:
_IEEE_ The return value is -Inf.
_POSIX_ Same as _IEEE_, but errno is also set to ERANGE.
_XOPEN_ Same as _IEEE_, but if matherr(3) returns 0, errno is set to
EDOM. The exception type is SING.
_SVID_ Same as _XOPEN_, but the return value is MAXFLOAT, and a mes-
sage is printed to stderr if errno is set.
For log(), logf(), log10() or log10f(), if x < 0 then:
_IEEE_ The return value is -Inf.
_POSIX_ Same as _IEEE_, but errno is also set to EDOM.
_XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0.
The exception type is DOMAIN.
_SVID_ Same as _XOPEN_, but the return value is MAXFLOAT, and a mes-
sage is printed to stderr if errno is set.
For pow() or powf(), if x = 0 and y = 0 then an error is reported in
_SVID_ mode. The return value is 0, and if matherr(3) returns 0, a mes-
sage is printed to stderr and errno is set to EDOM. The exception type is
DOMAIN. In all other modes, there is no error and the return value is 1.
For pow() or powf(), if x = 0 and y < 0 then:
_IEEE_ The return value is -Inf.
_POSIX_ Same as _IEEE_, but errno is also set to EDOM.
_XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0.
The exception type is DOMAIN.
_SVID_ Same as _XOPEN_, but the return value is 0, and a message is
printed to stderr if errno is set.
For pow() or powf(), if x < 0 and y is not an integer, then:
_IEEE_ The return value is NaN.
_POSIX_ Same as _IEEE_, but errno is also set to EDOM.
_XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0.
The exception type is DOMAIN.
_SVID_ Same as _XOPEN_, but the return value is 0, and a message is
printed to stderr if errno is set.
For pow() or powf(), if the result would overflow or underflow, then:
_IEEE_ The return value is +-Inf or 0, respectively. The sign on
overflow is positive unless x is negative and y is an odd inte-
ger.
_POSIX_ Same as _IEEE_, but errno is also set to ERANGE.
_XOPEN_ Same as _POSIX_, but errno is only set if matherr(3) returns 0.
The exception type is OVERFLOW or UNDERFLOW, respectively.
_SVID_ Same as _XOPEN_, but on overflow the result is +-MAXFLOAT.
For pow() or powf(), if x = NaN and y = 0 then:
_IEEE_ The return value is 1.
_POSIX_ The return value is 1. No error is reported.
_XOPEN_ The return value is NaN. If matherr(3) returns 0, errno is set
to EDOM. The exception type is DOMAIN.
_SVID_ Same as _XOPEN_.
SEE ALSOmath(3)HISTORY
The exp(), log() and pow() functions appeared in Version 6 AT&T UNIX. A
log10() function appeared in Version 7 AT&T UNIX. The log1p() and
expm1() functions appeared in 4.3BSD.
4th Berkeley Distribution February 17, 1998 3