log
double  log ( double x );
math.h
  cplusplus.com  

Calculate natural logarithm.
  Returns the natural logarithm of parameter x.

Parameters.

x
Floating point value.

Return Value.
  Logarithm of x.

Portability.
  Defined in ANSI-C.
  ANSI-C++ adds float and double overloaded versions of this function, with the same bahavior but being both, parameter and result, of one of these types.

Example.

/* log example */
#include <stdio.h>
#include <math.h>

main ()
{
  double param, result;
  param = 5.5;
  result = log (param);
  printf ("ln(%lf) = %lf\n", param, result );
  return 0;
}
Output:
ln(5.500000) = 1.704748

See also.
  log10, exp, pow, sqrt


© The C++ Resources Network, 2000