PRECISION(3) - [MODEL:NUMERIC] Decimal precision of a real kind
result = precision(x)
integer function precision(x)TYPE(kind=**),intent(in) :: x
o X shall be of type real or complex. It may be a scalar or an array. o the result is a default integer scalar.
PRECISION(3) returns the decimal precision in the model of the type of X.
o X : the type and kind of the argument are used to determine which number model to query. The value of the argument is not unused; it may even be undefined.
The precision of values of the type and kind of X
Sample program:
program demo_precision use,intrinsic :: iso_fortran_env, only : dp=>real64,sp=>real32 implicit none real(kind=sp) :: x(2) complex(kind=dp) :: yResults:print *, precision(x), range(x) print *, precision(y), range(y)
end program demo_precision
> 6 37 > 15 307
Fortran 95
DIGITS(3), EPSILON(3), EXPONENT(3), FRACTION(3), HUGE(3), MAXEXPONENT(3), MINEXPONENT(3), NEAREST(3), RADIX(3), RANGE(3), RRSPACING(3), SCALE(3), SET_EXPONENT(3), SPACING(3), TINY(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
Nemo Release 3.1 | precision (3fortran) | November 02, 2024 |