Math: Bitwise Functions
A bitwise function operates on one or more bit patterns or binary numerals at the level of their individual bits. Use a bitwise function to manipulate values for comparisons and calculations. Bitwise functions can only be used with Number data types.
BinaryAnd
BinaryAnd(n,m)
: Returns a binary of (n) and (m). The result is 1 if both n and m are 1, and 0 otherwise. If 0 is equated with false, and 1 with true the BinaryAnd operation works like a logical And.
Example
BinaryAnd(1,1)
returns 1.
BinaryAnd(1,0)
returns 0.
BinaryNot
BinaryNot(n)
: Returns a Binary Not of (n).
Example
BinaryNot(6)
returns -7.
BinaryNot(2)
returns -3.
BinaryOr
BinaryOr(n,m)
: Returns a Binary Or of (n) and (m).
Example
BinaryOr(6,6)
returns 6.
BinaryOr(6,2)
returns 6.
BinaryXOR
BinaryXOr(n,m)
: Returns a Binary XOr of (n) and (m).
Example
BinaryXOr(6,6)
returns 0.
BinaryXOr(6,2)
returns 4.
ShiftLeft
ShiftLeft(n,b)
: Left shifts (n) (as integer) by (b) bits.
ShiftRight
ShiftRight(n,b)
: Right shifts (n) (as integer) by (b) bits.