Borland C++ reference

log, logl

raw OCR

Calculates the natural logarithm of x.

Defined in header <math.h>

Syntax

Real versions:                    Complex  version:
#include <math.h>                 #include <complex.h>
double log(double x);             complex  log(complex x);
long double logKlong double  x);

Portability

DOSUNIXWindowsANSI CC++ only
logl ■■
Real log ■■■■
Complex log ■■■

Remarks

log calculates the natural logarithm of x. logl is the long double version; it takes a long double argument and returns a long double result.

The complex natural logarithm is defined by

log(z) = log(abs(2)) + / arg(2)

Return value

On success, log and logl return the value calculated, Inix).

If the argument x passed to these functions is real and less than 0, the global variable errno is set to

EDOM Domain error

If X is 0, the functions return the value negative HUGEVAL(log) or
negative _LHUGE_VAL(logl), and set errno to ERANGE.

Error handling for these routines can be modified through the functions matherr and _matherrl.

See also

Example

#include <math.h>
#include <stdio.h>

int main(void)
{
   double result, x = 8.6872;
   result = log(x);
   printfC'The natural log of %lf is %lf\n", x, result);
   return 0;
}

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.

Extraction notes

  • heading `logjogl` read as `log, logl`