8.52 BIT_SIZE — Bit size inquiry function

Synopsis:

RESULT = BIT_SIZE(I)

Description:

BIT_SIZE(I) returns the number of bits (for integers, the precision plus the sign bit) represented by the type of I. The result of BIT_SIZE(I) is independent of the actual value of I.

Class:

Inquiry function

Arguments:
IThe type shall be INTEGER or UNSIGNED.
Return value:

The return value is of type INTEGER

Example:
program test_bit_size
    integer :: i = 123
    integer :: size
    size = bit_size(i)
    print *, size
end program test_bit_size
Standard:

Fortran 90 and later, extension for UNSIGNED (see Unsigned integers)