BITAND( ) Function

Returns the result of a bitwise AND operation performed on two or more numeric values.

BITAND(nExpression1, nExpression2,  nExpression26)

Return Values

Numeric

Parameters

  • nExpression1, nExpression2,... nExpression26
    Specifies the numeric values on which the bitwise AND operation is performed. If nExpressions are not integers, they are converted to integers before the bitwise AND operation is performed. A maximum of 26 parameters can be passed.

Remarks

BITAND( ) compares each bit in nExpressionN to the corresponding bit in nExpressionN+1. If the bits in nExpressionN and nExpressionN+1 are both 1, the corresponding result bit is set to 1; otherwise, the corresponding result bit is set to 0.

The following table shows the result of a bitwise AND operation on corresponding nExpressionN and nExpressionN+1 bits:

nExpressionN bit nExpressionN+1 bit Resulting bit
0 0 0
0 1 0
1 1 1
1 0 0

Example

x = 3  && 0011 binary
y = 6  && 0110 binary

? BITAND(x,y) && Returns 2, 0010 binary

See Also

BITCLEAR( ) | BITLSHIFT( ) | BITNOT( ) | BITOR( ) | BITRSHIFT( ) | BITSET( ) | BITTEST( ) | BITXOR( )