9.3.21 BTEST (I, POS)

Description:  Tests a bit of an integer argument.  
Class:  Elemental function 
Arguments:  I Must be of type integer.  
  POS Must be of type integer. It must not be negative and it must be less than BIT_SIZE (I). 
Results:  The result type is default logical.

The result is true if bit POS of I has the value 1. The result is false if POS has the value zero. For information on the model for the interpretation of an integer value as a sequence of bits, see Section D.3.

The setting of compiler options specifying integer size can affect this function. 

Specific Name  Argument Type  Result Type 
  INTEGER(1)  LOGICAL(1) 
BITEST  INTEGER(2)  LOGICAL(2) 
BTEST[1]  INTEGER(4)  LOGICAL(4) 
BKTEST  INTEGER(8)  LOGICAL(8) 

[1] Or BJTEST

Examples

BTEST (9, 3) has the value true.

If A has the value

  [ 1  2 ]
  [ 3  4 ],
the value of BTEST (A, 2) is
  [ false  false ]
  [ false   true ]
and the value of BTEST (2, A) is
  [ true   false ]
  [ false  false ].


Previous Page Next Page Table of Contents