Operators bitor, bitxor, bitand

### 5.3.1 Operators bitor, bitxor, bitand

The integers may be written using hexadecimal notation 0x... for example 0x1f represents 16+15=31 in decimal. Integers may also be output in hexadecimal notation (click on the red CAS status button and select Base (Integers)).
bitor is the logical inclusive or (bitwise).
Input :

bitor(0x12,0x38)

or :

bitor(18,56)

Output :

58

because :
18 is written 0x12 in base 16 or 0b010010 in base 2,
56 is written 0x38 in base 16 or 0b111000 in base 2,
hence bitor(18,56) is 0b111010 in base 2 and so is equal to 58.
bitxor is the logical exclusive or (bitwise).
Input :

bitxor(0x12,0x38)

or :

bitxor(18,56)

Output :

42

because :
18 is written 0x12 in base 16 and 0b010010 in base 2,
56 is written 0x38 in base 16 and 0b111000 in base 2,
bitxor(18,56) is written 0b101010 in base 2 and so, is equal to 42.
bitand is the logical and (bitwise).
Input :

bitand(0x12,0x38)

or :

bitand(18,56)

Output :

16

because :
18 is written 0x12 in base 16 and 0b010010 in base 2,
56 is written 0x38 in base 16 and 0b111000 in base 2,
bitand(18,56) is written 0b010000 in base 2 and so is equal to 16.