LF Fortran 95

PRECISION Function

Description

The PRECISION function returns the decimal precision of a REAL or COMPLEX data type.

Syntax

PRECISION (x)

Arguments

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

Result

The result is of type default INTEGER.

Its value is equal to the number of decimal digits of precision in the data type of x.

Example

real(kind(1.e0)) :: r10 real(kind(1.d0)) :: r100 real(kind(1.q0)) :: r1000 write(*,*) precision(r10) ! writes 6 write(*,*) precision(r100) ! writes 15 write(*,*) precision(r1000) ! writes 33