Next: , Previous: BIT_SIZE, Up: Intrinsic Procedures


6.31 BTEST — Bit test function

Description:
BTEST(I,POS) returns logical .TRUE. if the bit at POS in I is set.
Standard:
F95 and later
Class:
Elemental function
Syntax:
RESULT = BTEST(I, POS)
Arguments:

I The type shall be INTEGER(*).
POS The type shall be INTEGER(*).

Return value:
The return value is of type LOGICAL
Example:
          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