Next: CONTINUE Up: COMPUTE Previous: COMPUTE DERIVATIVE   Contents   Index

### COMPUTE BTEST

```        [SIC\]COMPUTE OutVar BTEST InVar [Ibit]

Bit-test one or several bit values of the  input  variable,  and  return
true for each bit equal to 1.

The  optional integer argument Ibit indicate which bit should be tested.
The default is to check all the bits.

If all the bits of (a single element of) InVar are tested,  OutVar  must
be  an array with its first dimension equal to this number of bits, e.g.
32 for INTEGERs, 64 for DOUBLEs, etc. InVar may be  a  multi-dimensional
array, in which case OutVar must have the same extra-dimensions.

In  details,  this tool is an overlay to the BTEST Fortran function (ex-
cept that bit numbering starts at 1 here). Note that this hides the  ma-
chine dependencies (IEEE, EEEI, etc) by using a unique integer model re-
the Fortran documentation.

Examples:

SIC> define integer i
SIC> let i 2
SIC> define logical one
SIC> compute one btest i 1  ! First bit value
SIC> exa one
ONE             = F                          ! Logical GLOBAL

SIC> define logical all[32]
SIC> compute all btest i  ! All bit values
SIC> exa all
ALL             is a logical Array     of dimensions  32
F T F F F F F F F F F F F F F F F F F F F F F F
F F F F F F F F

SIC> define integer i2[3]
SIC> let i2 1 2 3
SIC> define logical one2[3]
SIC> compute one2 btest i2 2  ! Second bit values of the 3 elements
SIC> exa one2
ONE2            is a logical Array     of dimensions  3
F T T

SIC> define logical all2[32,3]
SIC> compute all2 btest i2  ! All bit values of all elements
SIC> exa all2[1] all2[2] all2[3]
ALL2[1]         is a logical Sub-Array of dimensions  32
T F F F F F F F F F F F F F F F F F F F F F F F
F F F F F F F F
ALL2[2]         is a logical Sub-Array of dimensions  32
F T F F F F F F F F F F F F F F F F F F F F F F
F F F F F F F F
ALL2[3]         is a logical Sub-Array of dimensions  32
T T F F F F F F F F F F F F F F F F F F F F F F
F F F F F F F F
```

Gildas manager 2014-07-01