BITTEST function

Syntax

BITTEST (expression, bit#)

Description

Use the BITTEST function to test the bit number of the integer specified by expression. The function returns 1 if the bit is set; it returns 0 if it is not. Bits are counted from right to left. The number of the rightmost bit is 0.

If expression evaluates to the null value, null is returned. If bit# evaluates to null, the BITTEST function fails and the program terminates with a run-time error message.

Values that are not integers are truncated before the operation is performed.

Example

PRINT 
BITTEST(11,0),BITTEST(11,1),BITTEST(11,2),BITTEST(11,
3)
* The binary value of 11 = 1011

This is the program output:

1   1   0   1