Macaulay2 » Documentation
Packages » RInterface :: bitwise logical operations on RObjects
next | previous | forward | backward | up | index | toc

bitwise logical operations on RObjects -- bitwise logical operations on R objects

These bitwise logical operations use syntax equivalent to their Macaulay2 counterparts.

~ is bitwise not, calling R's bitwNot.

i1 : x = RObject 12

o1 = [1] 12

o1 : RObject of type integer
i2 : y = RObject 10

o2 = [1] 10

o2 : RObject of type integer
i3 : x~

o3 = [1] -13

o3 : RObject of type integer

& is bitwise and, calling R's bitwAnd.

i4 : x & y

o4 = [1] 8

o4 : RObject of type integer

| is bitwise or, calling R's bitwOr.

i5 : x | y

o5 = [1] 14

o5 : RObject of type integer

^^ is bitwise xor, calling R's bitwXor.

i6 : x ^^ y

o6 = [1] 6

o6 : RObject of type integer

<< and >> are the bitwise shift operators, calling R's bitwShiftL and bitwShiftR, respectively.

i7 : x << y

o7 = [1] 12288

o7 : RObject of type integer
i8 : oo >> y

o8 = [1] 12

o8 : RObject of type integer

For the binary operators, one of the operands may be a Macaulay2 object. It will be converted to an RObject before the operation is performed.

i9 : x & 10

o9 = [1] 8

o9 : RObject of type integer
i10 : 12 | y

o10 = [1] 14

o10 : RObject of type integer