An integer function operates on 1 or more bit patterns or binary numerals at the level of their individual bits. Use an integer function to manipulate values for comparisons and calculations. Integer functions can only be used with Number data types.
Note
Not all functions are supported between Standard mode and Cloud Native mode tools. For a list of supported functions, go to the respective Standard mode and Could Native mode function lists found on the Formula tool page.
Important
If double/float values are given as arguments, they are truncated to 64-bit integers. Negative values are treated as two’s complement, 64-bit integer numbers. That is, -16 and -16.9999 are treated as 0xfffffffffffffff0.
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. Note the absence of the decimal point on the result values. The result is an integer, not a float value.
BinaryAnd(1,1)
returns 1.
BinaryAnd(1,0)
returns 0.
BinaryAnd(12,6)
returns 4.
BinaryAnd(12.99, 6.99)
returns 4.
BinaryAnd(-12, 6.99)
returns 4.
BinaryNot(n)
: Returns a Binary Not of (n). Numbers are treated as 64-bit, two's complement numbers.
BinaryNot(6)
returns -7.
BinaryNot(2)
returns -3.
BinaryNot(-1)
returns 0.
BinaryNot(0)
returns -1.
BinaryOr(n,m)
: Returns a Binary Or of (n) and (m).
BinaryOr(6,6)
returns 6.
BinaryOr(6,2)
returns 6.
BinaryOr(4,2)
returns 6.
BinaryOr(12,6)
returns 14.
BinaryXOr(n,m)
: Returns a Binary XOr of (n) and (m).
BinaryXOr(6,6)
returns 0.
BinaryXOr(6,2)
returns 4.
BinaryXOr(6,12)
returns 10.
ShiftLeft(n,b)
: Left shifts (n) (as integer) by (b) bits.
ShiftRight(n,b)
: Right shifts (n) (as integer) by (b) bits.
For both ShiftLeft and ShiftRight the result is an Int64, so only 64 bits are available.
ShiftLeft(pow(2,62),1)
returns-pow(2,63)
. Shift it left once more and you get zero.
ShiftRight(1,1)
returns zero.
ShiftRight(-1,1)
returnsInt64_Max
.