LOG(X)

Purpose

Natural logarithm.

Class

Elemental function

Argument type and attributes

X
An INTENT(IN) REAL or COMPLEX
  • If X is REAL, its value must be greater than zero.
  • If X is COMPLEX, its value must not be zero.

Result type and attributes

Same as X.

Result value

  • It has a value approximating logeX.
  • For complex arguments, LOG ((a,b)) approximates LOG (ABS((a,b))) + ATAN2((b,a)).

The -qxlf2003=signdzerointr option controls whether you get Fortran 2003 behavior. See qxlf2003 in the XL Fortran Compiler Reference

  • If the argument type is complex, the result is the principal value of the imaginary part OMEGA in the range -PI < OMEGA ≤ PI. If the real part of the argument is less than zero and its imaginary part is zero, the imaginary part of the result approximates PI.

  • Fortran 2003 begins If the argument type is complex, the result is the principal value of the imaginary part OMEGA in the range -PI < OMEGA ≤ PI. If the real part of the argument is less than zero and its imaginary part is zero, the imaginary part of the result approximates PI if the imaginary part of X is positive real zero. If the imaginary part of X is negative real zero, the imaginary part of the result approximates -PI Fortran 2003 ends

Examples

LOG (10.0) has the value 2.3025851 (approximately).

Specific Name Argument Type Result Type Pass As Arg?
ALOG default real default real yes
DLOG double precision real double precision real yes
QLOG REAL(16) REAL(16) yes  1 
CLOG default complex default complex yes
CDLOG double complex double complex yes  1 
ZLOG double complex double complex yes  1 
CQLOG COMPLEX(16) COMPLEX(16) yes  1 
Note:
  •  1  IBM extension: the ability to pass the name as an argument.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us