SELECTED_REAL_KIND
— Choose real kindSELECTED_REAL_KIND(P,R)
returns the kind value of a real data type with decimal precision of at least P
digits, exponent range of at least R
, and with a radix of RADIX
. RADIX
Fortran 2008 or later RESULT = SELECTED_REAL_KIND([P, R, RADIX])
P | (Optional) shall be a scalar and of type INTEGER . |
R | (Optional) shall be a scalar and of type INTEGER . |
RADIX | (Optional) shall be a scalar and of type INTEGER . |
SELECTED_REAL_KIND
returns the value of the kind type parameter of a real data type with decimal precision of at least P
digits, a decimal exponent range of at least R
, and with the requested RADIX
. If the RADIX
parameter is absent, real kinds with any radix can be returned. If more than one real data type meet the criteria, the kind of the data type with the smallest decimal precision is returned. If no real data type matches the criteria, the result is P
, but the R
and RADIX
requirements can be fulfilled R
, but P
and RADIX
are fulfillable RADIX
but not P
and R
requirementsRADIX
and either P
or R
requirementsRADIX
program real_kinds integer,parameter :: p6 = selected_real_kind(6) integer,parameter :: p10r100 = selected_real_kind(10,100) integer,parameter :: r400 = selected_real_kind(r=400) real(kind=p6) :: x real(kind=p10r100) :: y real(kind=r400) :: z print *, precision(x), range(x) print *, precision(y), range(y) print *, precision(z), range(z) end program real_kinds
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/SELECTED_005fREAL_005fKIND.html