Clicky

Fortran Wiki
bit_size

Description

bit_size(i) returns the number of bits (integer precision plus sign bit) represented by the type of i.

Standard

Fortran 95 and later

Class

Inquiry function

Syntax

result = bit_size(i)

Arguments

  • i - The type shall be integer.

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

category: intrinsics