2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
20 .. index:: exponential function, inverse
22 .. index:: logarithm function
24 .. index:: natural logarithm function
26 LOG --- Natural logarithm function
27 **********************************
31 ``LOG(X)`` computes the natural logarithm of :samp:`{X}`, i.e. the
32 logarithm to the base e.
35 The type shall be ``REAL`` or
39 The return value is of type ``REAL`` or ``COMPLEX``.
40 The kind type parameter is the same as :samp:`{X}`.
41 If :samp:`{X}` is ``COMPLEX``, the imaginary part \omega is in the range
42 -\pi < \omega \leq \pi.
45 Fortran 77 and later, has GNU extensions
51 .. code-block:: fortran
56 .. code-block:: fortran
59 real(8) :: x = 2.7182818284590451_8
60 complex :: z = (1.0, 2.0)
61 x = log(x) ! will yield (approximately) 1