9.3.22 BTEST (I, POS)

Description:  Tests a bit of an integer argument.  
Class:  Elemental function; Generic 
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).

The rightmost (least significant) bit of I is in position 0. 
Results:  The result is of type 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 more information on bit functions, see Section 9.2.3.

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