SELECTED_UNSIGNED_KIND (The GNU Fortran Compiler)

### 8.251 `SELECTED_UNSIGNED_KIND` — Choose unsigned kind ¶

Synopsis:

  `RESULT = SELECTED_UNSIGNED_KIND(R)`

Description:

  `SELECTED_UNSIGNED_KIND(R)` return the kind value of the smallest integer type that can represent all values ranging from 0 to 10^R (exclusive). If there is no unsigned kind that accommodates this range, `SELECTED_UNSIGNED_KIND` returns -1.

Class:

  Transformational function

Arguments:

  R | Shall be a scalar and of type `INTEGER`.

Example:

      program large_unsigned
        integer,parameter :: k5 = selected_unsigned_kind(5)
        integer,parameter :: k15 = selected_unsigned_kind(15)
        unsigned(kind=k5) :: i5
        unsigned(kind=k15) :: i15

        print *, huge(i5), huge(i15)
      end program large_unsigned

Standard:

  Extension for `UNSIGNED` (see Unsigned integers)