SELECTED_INT_KIND(3) - [KIND] Choose integer kind
result = selected_int_kind(r)
integer function selected_int_kind(r)
integer(kind=KIND),intent(in) :: r
o R is an integer scalar. o the result is an default integer scalar.
SELECTED_INT_KIND(3) return the kind value of the smallest integer type that can represent all values ranging from -10**R (exclusive) to 10**R (exclusive). If there is no integer kind that accommodates this range, selected_int_kind returns -1.
o R : The value specifies the required range of powers of ten that need supported by the kind type being returned.
The result has a value equal to the value of the kind type parameter of an integer type that represents all values in the requested range.
if no such kind type parameter is available on the processor, the result is -1.
If more than one kind type parameter meets the criterion, the value returned is the one with the smallest decimal exponent range, unless there are several such values, in which case the smallest of these kind values is returned.
Sample program:
program demo_selected_int_kind implicit none integer,parameter :: k5 = selected_int_kind(5) integer,parameter :: k15 = selected_int_kind(15) integer(kind=k5) :: i5 integer(kind=k15) :: i15Results:print *, huge(i5), huge(i15)
! the following inequalities are always true print *, huge(i5) >= 10_k5**5-1 print *, huge(i15) >= 10_k15**15-1 end program demo_selected_int_kind
> 2147483647 9223372036854775807 > T > T
Fortran 95
AINT(3), ANINT(3), INT(3), NINT(3), CEILING(3), FLOOR(3)
Fortran intrinsic descriptions (license: MIT) @urbanjost
Nemo Release 3.1 | selected_int_kind (3fortran) | November 02, 2024 |