Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

LOG

Elemental Intrinsic Function (Generic): Returns the natural logarithm of the argument.

result = LOG (x)

x

(Input) Must be of type real or complex. If x is real, its value must be greater than zero. If x is complex, its value must not be zero.

Results

The result type and kind are the same as x. The result value is approximately equal to logex.

If the arguments are complex, the result is the principal value with imaginary part omega in the range -pi <= omega <= pi.

If the real part of x < 0 and the imaginary part of x is a positive real zero, the imaginary part of the result is pi.

If the real part of x < 0 and the imaginary part of x is a negative real zero, the imaginary part of the result is -pi.

Specific Name

Argument Type

Result Type

ALOG 1,2

REAL(4)

REAL(4)

DLOG

REAL(8)

REAL(8)

QLOG

REAL(16)

REAL(16)

CLOG 2

COMPLEX(4)

COMPLEX(4)

CDLOG3,4

COMPLEX(8)

COMPLEX(8)

CQLOG

COMPLEX(16)

COMPLEX(16)

1This function is treated like LOG.

2The setting of compiler options specifying real size can affect ALOG, LOG, and CLOG.

3This function can also be specified as ZLOG.

4The setting of compiler options specifying double size can affect CDLOG.

Example

LOG (8.0) has the value 2.079442.

LOG (25.0) has the value 3.218876.

The following shows another example:

REAL r
r = LOG(10.0)  ! returns 2.302585

See Also