9.209 PRECISION — Decimal precision of a real kind

Description:

PRECISION(X) returns the decimal precision in the model of the type of X.

Standard:

Fortran 95 and later

Class:

Inquiry function

Syntax:

RESULT = PRECISION(X)

Arguments:
X Shall be of type REAL or COMPLEX.
Return value:

The return value is of type INTEGER and of the default integer kind.

See also:

SELECTED_REAL_KIND, RANGE

Example:
program prec_and_range
  real(kind=4) :: x(2)
  complex(kind=8) :: y

  print *, precision(x), range(x)
  print *, precision(y), range(y)
end program prec_and_range

© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gfortran/PRECISION.html