log

Computes the natural logarithm (base e) of x

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Mathematical Computation

Syntax

  #include <math.h>  
   
  double log  (  
     double   x);
  

Parameters

x
(IN) Specifies the argument for which the natural logarithm is to be computed.

Return Values

The log function returns the natural logarithm of the argument. When the argument is outside the permissible range, errno is set and matherr is called. Unless matherr is replaced, matherr prints a diagnostic message using the stderr stream.

Remarks

A domain error occurs if the argument is negative. A range error occurs if the argument is zero.

See Also

exp, log10, matherr, pow

Example

  #include <math.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%f\n", log (.5) );  
  }
  

produces the following:

  -0.693147