LF Fortran 95

LOG10 Function

Description

The LOG10 function returns the common logarithm of a real argument.

Syntax

LOG10 (x)

Arguments

x is an INTENT(IN) scalar or array of type REAL.

The value of x must be greater than zero.

Result

The result is of the same type and kind as x.

Its value is a REAL representation of log 10x.

If x is zero, a floating divide exception occurs, and unless trapped, the value -Inf (negative infinity) is returned.

If x is less than zero, an invalid operation exception occurs, and unless trapped, the value -NaN (not a number) is returned.

Example

real :: x=1.,xa(2)=(/.5,1.5/) write(*,*) log10(x) ! writes 0.0 write(*,*) log10(xa) ! writes -.303103001 .17609125 write(*,*) log10(0.) ! writes -Inf or error occurs write(*,*) log10(-1.) ! writes -NaN or error occurs