suivant: Hamming distance bit to monter: Operators bit to bit précédent: Operators bit to bit   Table des matières   Index

## Operators bitor, bitxor, bitand

The integers may be written using hexadecimal notation 0x... for example 0x1f represents 16+15=31 in decimal writting. Integers may also be outputted in hexadecimal notation (click on the red CAS status button and select Base (Integers)).
bitor is the logical inclusive or (bit to bit).
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 (bit to bit).
Input :

bitxor(0x12,0x38)
or input :
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 en base 2 and so, is equal to 42.

bitand is the logical and (bit to bit).
Input :

bitand(0x12,0x38)
or input :
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.

suivant: Hamming distance bit to monter: Operators bit to bit précédent: Operators bit to bit   Table des matières   Index
giac documentation written by Renée De Graeve and Bernard Parisse