BTEST(3I) Last changed: 1-6-98
NAMEBTEST - Tests a bit of an integer value
SYNOPSISBTEST ([I=]i, [POS=]pos)
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
STANDARDS
Fortran 90
DESCRIPTION
The BTEST intrinsic function tests a bit of an integer value. It
accepts the following arguments:
i Must be of type integer.
pos Must be of type integer. It must be nonnegative and be less
than BIT_SIZE(i).
BTEST is an elemental function. The name of this intrinsic cannot be
passed as an argument.
RETURN VALUES
The result is of type default logical. The result has the value TRUE
if bit pos of i has the value 1. It has the value FALSE if bit pos of
i has the value 0. The bit model defines the interpretation of an
integer value as a sequence of bits. This model is described in the
MODELS(3I) man page.
EXAMPLES
Example 1: BTEST(8, 3) has the value TRUE.
Example 2: BTEST(8_SHORT, 3) has the value TRUE.
Example 3: Assume that A has the following value:
| 1 2 |
| 3 4 |
The value of BTEST(A, 2) is as follows:
| false false |
| false true |
The value of BTEST(2, A) is as follows:
| true false |
| false false |
SEE ALSOMODELS(3I)
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.