|
|
cc [flag . . .] file . . . -lm [library . . .]#include <math.h>
int ilogb(double x);
int ilogbf(float x);
int ilogbl(long double x);
double log(double x);
float logf(float x);
long double logl(long double x);
double log1p(double x);
float log1pf(float x);
long double log1pl(long double x);
double log2(double x);
float log2f(float x);
long double log2l(long double x);
double log10(double x);
float log10f(float x);
long double log10l(long double x);
double logb(double x);
float logbf(float x);
long double logbl(long double x);
log, logf and logl return the natural logarithm of x. The value of x must be positive.
log1p, log1pf and log1pl return the natural logarithm of 1.0+x. The value of x must be greater than -1.0.
log2, log2f and log2l return the base two logarithm of x. The value of x must be positive.
log10, log10f and log10l return the base ten logarithm of x. The value of x must be positive.
logb, logbf and logbl return the signed exponent of x.
loglp, loglpf and loglpl return a value that compares equal to -HUGE_VAL, -HUGE_VALF or -HUGE_VALL and set errno to ERANGE when x is -1. On systems that support IEEE floating-point, the divide by zero exception is raised.
If x is negative, log, log2 and log10 (and their floating and long double equivalents) return IEEE NaN on systems that support it and raise the invalid operation exception. Otherwise, they return zero and set errno to EDOM.
If x is less than -1, loglp, loglpf and loglpl return IEEE NaN on systems that support it and raise the invalid operation exception. Otherwise, they return zero and set errno to EDOM.
On systems that support IEEE NaN, if any of the inputs to each of these functions is a quiet NaN, that value is returned. If any input is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM.
If the program was compiled with the -Xt compilation mode, a value that will compare equal to ±HUGE is returned instead of ±HUGE_VAL. log, log2 and log10 (and their floating and long double equivalents) return a value that compares equal to -HUGE for non-positive arguments and set errno to EDOM. In addition, a message indicating DOMAIN error is printed on the standard error output. These error handling procedures can be changed with the function matherr.