The SELECTED_REAL_KIND function returns the 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.
Syntax
SELECTED_REAL_KIND ([p] [, r])
p is an INTENT(IN) scalar INTEGER, representing the requested precision.
r is an INTENT(IN) scalar INTEGER representing the requested exponent range.
At least one argument must be present.
The result is a scalar default INTEGER. Its value is equal to the processor dependent kind type parameter of the REAL data type with decimal precision of at least p digits and a decimal exponent range of at least r.
If more than one kind is available, the return value is the value of the kind type parameter of the kind with the smallest decimal precision.
The result is -1 if the precision is not available, -2 if the range is not available, and -3 if neither is available.
Example
! request a precision write(*,*) selected_real_kind(p=6) ! writes 4 write(*,*) selected_real_kind(p=12) ! writes 8 write(*,*) selected_real_kind(p=24) ! writes 16 write(*,*) selected_real_kind(p=48) ! writes -1 ! request a range write(*,*) selected_real_kind(r=10) ! writes 4 write(*,*) selected_real_kind(r=100) ! writes 8 write(*,*) selected_real_kind(r=1000) ! writes 16 write(*,*) selected_real_kind(r=10000) ! writes -2 write(*,*) selected_real_kind(r=10000,p=48) ! writes -3