FORTRAN Reference Manual
Intrinsic Functions
FORTRAN Reference Manual—528615-001
8-21
LOG Function
LEN is particularly useful to determine the length of a character type argument to a 
subroutine. See the following example.
Example of the LEN Function
SUBROUTINE word (entry, length)
CHARACTER entry * (*)
length = LEN (entry)
IF (length .GT. 80) THEN
 PRINT *, 'Your entry is too long!'
 END IF
END
LOG Function
The LOG function returns a natural (or base e) logarithm.
The table below shows the argument and function type for the LOG generic function 
and its associated specific functions.
Considerations
•
The result type of the LOG function is the same as the type of its argument.
•
For a real or double precision argument x, the value of LOG (x) is the number Y 
that:
x = e
y
where e is the natural logarithm base, or approximately
2.71828 18284 59045
If x < 0, program execution terminates abnormally with an error message.
•
For a complex argument z = CMPLX (x, y), the value of LOG(z) is defined as
CMPLX (ALOG (CABS (z)), ATAN2 (y, x))
If x = 0 and y = 0, program execution terminates abnormally with an error 
message.
Syntax Argument Type Function Type
LOG (x)
ALOG (x) Real Real
DLOG (x) Double Precision Double Precision
CLOG (x) Complex Complex
x is an arithmetic expression.










