This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

BitAnd

BitAnd
gives the bitwise AND of the integers .
  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • BitAnd yields the integer whose binary bit representation has ones at positions where the binary bit representations of all of the have ones.
  • For negative integers BitAnd assumes a two's complement representation.
  • BitAnd automatically threads over lists.
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Use numbers of any size:
BitAnd takes any number of arguments:
Use negative numbers:
Basic symbolic simplifications are done automatically:
Extract the second-lowest-order bits in numbers:
"Mask" to test whether bits 3 or 4 are 1:
Make a nested pattern:
Test for powers of 2:
New in 4