WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

BitAnd [n1,n2,]

gives the bitwise AND of the integers ni.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Generalizations & Extensions  
Applications  
Properties & Relations  
Neat Examples  
See Also
Tech Notes
Related Guides
Related Links
History
Cite this Page

BitAnd [n1,n2,]

gives the bitwise AND of the integers ni.

Details

  • Integer mathematical function, suitable for both symbolic and numerical manipulation.
  • BitAnd [n1,n2,] yields the integer whose binary bit representation has ones at positions where the binary bit representations of all of the ni have ones.
  • For negative integers BitAnd assumes a two's complement representation.
  • BitAnd automatically threads over lists.

Examples

open all close all

Basic Examples  (1)

Scope  (3)

Use numbers of any size:

BitAnd takes any number of arguments:

Use negative numbers:

Generalizations & Extensions  (1)

Basic symbolic simplifications are done automatically:

Applications  (5)

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:

Properties & Relations  (2)

Truth table for And :

BitAnd is Orderless :

Neat Examples  (1)

See Also

BitOr   BitXor   BitNot   BitGet   And   IntegerDigits   DigitCount   CellularAutomaton   Pick

Function Repository: BitBooleanFunction

History

Introduced in 1999 (4.0)

Wolfram Research (1999), BitAnd, Wolfram Language function, https://reference.wolfram.com/language/ref/BitAnd.html.

Text

Wolfram Research (1999), BitAnd, Wolfram Language function, https://reference.wolfram.com/language/ref/BitAnd.html.

CMS

Wolfram Language. 1999. "BitAnd." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BitAnd.html.

APA

Wolfram Language. (1999). BitAnd. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BitAnd.html

BibTeX

@misc{reference.wolfram_2025_bitand, author="Wolfram Research", title="{BitAnd}", year="1999", howpublished="\url{https://reference.wolfram.com/language/ref/BitAnd.html}", note=[Accessed: 17-November-2025]}

BibLaTeX

@online{reference.wolfram_2025_bitand, organization={Wolfram Research}, title={BitAnd}, year={1999}, url={https://reference.wolfram.com/language/ref/BitAnd.html}, note=[Accessed: 17-November-2025]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /