Next: C_ASSOCIATED, Previous: BLT, Up: Intrinsic Procedures [Contents][Index]
BTEST — Bit test functionBTEST(I,POS) returns logical .TRUE. if the bit at POS
in I is set. The counting of the bits starts at 0.
Fortran 95 and later
Elemental function
RESULT = BTEST(I, POS)
| I | The type shall be INTEGER. |
| POS | The type shall be INTEGER. |
The return value is of type LOGICAL
program test_btest
integer :: i = 32768 + 1024 + 64
integer :: pos
logical :: bool
do pos=0,16
bool = btest(i, pos)
print *, pos, bool
end do
end program test_btest