selected_real_kind(3I)

SELECTED_REAL_KIND - Returns the real kind type parameter

As shipped in IRIX 6.5.15. Last changed in IRIX 6.5.5.

NAME
     SELECTED_REAL_KIND - Returns the real kind type parameter

SYNOPSIS
     SELECTED_REAL_KIND ([[P=]p] [,[R=]r])

IMPLEMENTATION
     UNICOS, UNICOS/mk, IRIX systems

     CF90, MIPSpro 7 Fortran 90

STANDARDS
     Fortran

DESCRIPTION
     The SELECTED_REAL_KIND intrinsic function returns the real kind type
     parameter of a real data type with decimal precision of at least p
     digits and a decimal exponent range of at least r.  At least one
     argument must be present, and the arguments are as follows:

     p         Must be scalar and of type integer.

     r         Must be scalar and of type integer.

     SELECTED_REAL_KIND is a transformational function.  The name of this
     intrinsic cannot be passed as an argument.

RETURN VALUES
     This intrinsic function returns the real kind type parameter
     corresponding to the decimal precision and exponent range specified by
     its arguments.  The result is a default integer scalar.  The result
     has a value equal to a value of the kind type parameter of a real data
     type with decimal precision, as returned by the function PRECISION, of
     at least p digits and a decimal exponent range, as returned by the
     function RANGE, of at least r, or if no such kind type parameter
     exists, the result is -1 if the precision is not available, -2 if the
     exponent range is not available, and -3 if neither is available.  If
     more than one kind type parameter value meets the criteria, the value
     returned is the one with the smallest decimal precision, unless there
     are several such values, in which case the smallest of these kind
     values is returned.

EXAMPLES
     On UNICOS and UNICOS/mk systems, the following program is run:

         PARAMETER (NP=9,NR=9)
         INTEGER P(NP),R(NR),A(NR),B(NP)
         DATA P /-1,0,1,6,7,13,14,28,29/
         DATA R /-1,0,1,37,38,307,308,2465,2466/
         WRITE (6,FMT='('' (P,R)|'',10I5)') R
         WRITE(6,FMT='(" ----------------------------------------------")')
         DO I=1,NP
           DO J=1,NR
             A(J)=SELECTED_REAL_KIND(P(I),R(J))
           END DO
           WRITE (6,FMT='(I6,''|'',10I5)') P(I),(A(K),K=1,NR)
         END DO

         WRITE(6,FMT='(//)')
         WRITE (6,FMT='('' (P)  | (R=NULL)'',10I5)')
         WRITE(6,FMT='(" ----------------------------------------------")')
         DO I=1,NP
             B(I)=SELECTED_REAL_KIND(P=P(I))
         END DO
         WRITE (6,FMT='(I6,''|'',I5)') (P(K),B(K),K=1,NP)

         WRITE(6,FMT='(//)')
         WRITE (6,FMT='('' (P=NULL)| (R)'',10I5)') R
         WRITE(6,FMT='(" ----------------------------------------------")')
         DO J=1,NR
             A(J)=SELECTED_REAL_KIND(R=R(J))
         END DO
         WRITE (6,FMT='(I9,''|    '',10I5)') 0,(A(K),K=1,NR)

         STOP
         END

     On IRIX systems, the following program is run:

         PARAMETER (NP=9,NR=9)
         INTEGER P(NP),R(NR),A(NR)
   *     TEST CASE FOR IRIX
         DATA P /-1,0,1,6,7,15,16,31,32/
         DATA R /-1,0,1,37,38,291,292,307,308/
         WRITE (6,FMT='('' (P,R)|'',10I5)') R
         WRITE(6,FMT='(" ----------------------------------------------",
       +              "-----------------------")')
         DO I=1,NP
           DO J=1,NR
             A(J)=SELECTED_REAL_KIND(P(I),R(J))
           END DO
           WRITE (6,FMT='(I6,''|'',10I5)') P(I),(A(K),K=1,NR)
         END DO

         WRITE(6,FMT='(//)')
         WRITE (6,FMT='('' (P)  | (R=NULL)'',10I5)')
         WRITE(6,FMT='(" ----------------------------------------------")')
         DO I=1,NP
             A(I)=SELECTED_REAL_KIND(P=P(I))
         END DO
         WRITE (6,FMT='(I6,''|'',I5)') (P(K),A(K),K=1,NP)

         WRITE(6,FMT='(//)')
         WRITE (6,FMT='('' (P=NULL)| (R)'',10I5)') R
         WRITE(6,FMT='(" ----------------------------------------------",
       +              "------------------------------")')
         DO J=1,NR
             A(J)=SELECTED_REAL_KIND(R=R(J))
         END DO
         WRITE (6,FMT='(I9,''|    '',10I5)') 0,(A(K),K=1,NR)

         STOP
         END

     The following tables show the results obtained from the preceding
     programs.

     Return values on IRIX systems:

         (p,r) |   -1    0    1   37   38  291  292  307  308
         ------------------------------------------------------------------
            -1 |    4    4    4    4    8    8    8    8   -2
             0 |    4    4    4    4    8    8    8    8   -2
             1 |    4    4    4    4    8    8    8    8   -2
             6 |    4    4    4    4    8    8    8    8   -2
             7 |    8    8    8    8    8    8    8    8   -2
            15 |    8    8    8    8    8    8    8    8   -2
            16 |   16   16   16   16   16   -2   -2   -2   -2
            31 |   16   16   16   16   16   -2   -2   -2   -2
            32 |   -1   -1   -1   -1   -1   -1   -1   -1   -3

             (p) | (r=NULL)
           ----------------
              -1 |    4
               0 |    4
               1 |    4
               6 |    4
               7 |    8
              15 |    8
              16 |   16
              31 |   16
              32 |   -1

           (p=NULL) | (r)   -1    0    1   37   38  291  292  307  308
           -----------------------------------------------------------
                  0 |        4    4    4    4    8    8    8    8   -2

     Return values on CRAY T90 (IEEE) systems:

           (p,r) |   -1    0    1   37   38  307  308 4931 4932
           ----------------------------------------------------
              -1 |    4    4    4    4    8    8   16   16   -2
               0 |    4    4    4    4    8    8   16   16   -2
               1 |    4    4    4    4    8    8   16   16   -2
               6 |    4    4    4    4    8    8   16   16   -2
               7 |    8    8    8    8    8    8   16   16   -2
              15 |    8    8    8    8    8    8   16   16   -2
              16 |   16   16   16   16   16   16   16   16   -2
              33 |   16   16   16   16   16   16   16   16   -2
              34 |   -1   -1   -1   -1   -1   -1   -1   -1   -3

             (p) | (r=NULL)
           ----------------
              -1 |    4
               0 |    4
               1 |    4
               6 |    4
               7 |    8
              15 |    8
              16 |   16
              33 |   16
              34 |   -1

           (p=NULL) | (r)   -1    0    1   37   38  307  308 4931 4932
           -----------------------------------------------------------
                  0 |        4    4    4    4    8    8   16   16   -2

SEE ALSO
     MODELS(3I)

     Intrinsic Procedures Reference Manual for the printed version of this
     man page.