Manual Reference Pages  - selected_real_kind (3fortran)

NAME

SELECTED_REAL_KIND(3) - [KIND] Choose real kind

SYNOPSIS

result = selected_real_kind([p] [,r] [,radix] )

integer function selected_int_kind(r)

         real(kind=KIND),intent(in),optional :: p
         real(kind=KIND),intent(in),optional :: r
         real(kind=KIND),intent(in),optional :: radix

CHARACTERISTICS

o P is an integer scalar
o R is an integer scalar
o RADIX is an integer scalar
o the result is an default integer scalar

DESCRIPTION

SELECTED_REAL_KIND(3) return 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. That is, if such a kind exists

    + it has the decimal precision as returned by **precision**(3) of at
      least **p** digits.
    + a decimal exponent range, as returned by the function **range**(3)
      of at least **r**
    + a radix, as returned by the function **radix**(3) , of **radix**,

If the requested kind does not exist, -1 is returned.

At least one argument shall be present.

OPTIONS

o P : the requested precision
o R : the requested range
o RADIX : the desired radix

    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.

RESULT

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 P or R is absent, the result value is the same as if it were present with the value zero.

If the RADIX parameter is absent, there is no requirement on the radix of the selected kind and 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
o -1 : if the processor does not support a real data type with a precision greater than or equal to P, but the R and RADIX requirements can be fulfilled
o -2 : if the processor does not support a real type with an exponent range greater than or equal to R, but P and RADIX are fulfillable
o -3 : if RADIX but not P and R requirements are fulfillable
o -4 : if RADIX and either P or R requirements are fulfillable
o -5 : if there is no real type with the given RADIX

EXAMPLES

Sample program:

    program demo_selected_real_kind
    implicit none
    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 demo_selected_real_kind

Results:

      >            6          37
      >           15         307
      >           18        4931

STANDARD

Fortran 95 ; with RADIX - Fortran 2008

SEE ALSO

PRECISION(3), RANGE(3), RADIX(3)

fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 selected_real_kind (3fortran) April 28, 2024
Generated by manServer 1.08 from 842419f4-8ceb-4c86-9cf4-9e0689c76b79 using man macros.