BTEST(I, POS)

Purpose

Tests a bit of an integer value.

Class

Elemental function

Argument type and attributes

I
must be of type integer.
POS
must be of type integer. It must be nonnegative and be less than BIT_SIZE(I).

Result type and attributes

The result is of type default logical.

Result value

The result has the value .TRUE. if bit POS of I has the value 1 and the value .FALSE. if bit POS of I has the value 0.

The bits are numbered from 0 to BIT_SIZE(I)-1, from right to left.

Examples

BTEST (8, 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 |

See Integer bit model.

Specific Name Argument Type Result Type Pass As Arg?
BTEST  1  any integer default logical yes
Note:
  1. IBM Extension.