LF Fortran 95

SELECTED_INT_KIND Function

Description

The SELECTED_INT_KIND function returns the kind type parameter of an INTEGER data type.

Syntax

SELECTED_INT_KIND (r)

Arguments

r is an INTENT(IN) scalar INTEGER.

Result

The result is a scalar default INTEGER. Its value is equal to the processor dependent kind type parameter of the data type that accommodates all values n with -10r < n < 10r .

If more than one kind is available, the return value is the kind type parameter with the smaller decimal exponent range.

If no such kind is available in the specified range, the result is -1.

Example

write(*,*) selected_int_kind(2) ! writes 1 write(*,*) selected_int_kind(4) ! writes 2 write(*,*) selected_int_kind(7) ! writes 4 write(*,*) selected_int_kind(12) ! writes 8 write(*,*) selected_int_kind(20) ! writes -1