9.242 SELECTED_REAL_KIND — Choose real kind
- Description:
-
SELECTED_REAL_KIND(P,R)returns the kind value of a real data type with decimal precision of at leastPdigits, exponent range of at leastR, and with a radix ofRADIX. - Standard:
-
Fortran 95 and later, with
RADIXFortran 2008 or later - Class:
-
Transformational function
- Syntax:
-
RESULT = SELECTED_REAL_KIND([P, R, RADIX]) - Arguments:
-
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.Before Fortran 2008, at least one of the arguments R or P shall be present; since Fortran 2008, they are assumed to be zero if absent.
- Return value:
-
SELECTED_REAL_KINDreturns the value of the kind type parameter of a real data type with decimal precision of at leastPdigits, a decimal exponent range of at leastR, and with the requestedRADIX. If theRADIXparameter 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- -1 if the processor does not support a real data type with a
precision greater than or equal to
P, but theRandRADIXrequirements can be fulfilled- -2 if the processor does not support a real type with an exponent
range greater than or equal to
R, butPandRADIXare fulfillable- -3 if
RADIXbut notPandRrequirements are fulfillable
- -4 if
RADIXand eitherPorRrequirements are fulfillable
- -5 if there is no real type with the given
RADIX
- See also:
- Example:
-
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
Next: SET_EXPONENT, Previous: SELECTED_INT_KIND, Up: Intrinsic Procedures [Contents][Index]
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gfortran/SELECTED_005fREAL_005fKIND.html