BIT_SIZE — Bit size inquiry function

BIT_SIZE(I)

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

Parameters

I – The type shall be INTEGER.

Returns

The return value is of type INTEGER

Standard:

Fortran 90 and later

Class:

Inquiry function

Syntax:

RESULT = BIT_SIZE(I)

Example:

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