btest(3f) - [FORTRAN:INTRINSIC:BIT MANIPULATION] Bit test function
result = btest(i, pos)
btest(i,pos) returns logical .true. if the bit at POS in I is set.
I The type shall be INTEGER. POS The type shall be INTEGER. A value of zero refers to the least significant bit.
The return value is of type LOGICAL
Sample program:
program demo_btest implicit none integer :: i = 32768 + 1024 + 64 integer :: pos logical :: bool do pos=0,16 bool = btest(i, pos) print *, pos, bool end do end program demo_btest
[[Fortran 95]] and later
[[Elemental procedure|Elemental function]]
ibclr(3), ibits(3), ibset(3), iand(3), ior(3), ieor(3), mvbits(3)
btest (3) | March 11, 2021 |