LF Fortran 95

BIT_SIZE Function

Description

The BIT_SIZE function returns the number of bits in a data object of type INTEGER.

Syntax

BIT_SIZE (i)

Arguments

i is an INTENT(IN) scalar or array of type INTEGER.

Result

The result is the same kind as i. Its value is equal to the number of bits in an integer of kind i.

Example

integer(kind=selected_int_kind(4)) :: i integer(kind=selected_int_kind(12)) :: j integer,dimension(2) :: k write(*,*) bit_size(i) ! writes 16 write(*,*) bit_size(j) ! writes 64 write(*,*) bit_size(k) ! writes 32