
BITOR
The BITOR function returns the bitwise OR of two numbers.
BITOR(value-1, value-2)
value-1: The first number. value-1 must be an integer.
value-2: The second number. value-2 must be an integer.
Notes
Values can be in any order and return the same result.
The truth table for BITOR is below:
value-1 | value-2 | BITOR(value-1, value-2) |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Examples |
---|
=BITOR(9,13) returns 13. The binary equivalent of 9 is 1001, and the binary equivalent of 13 is 1101; the bits include 1 at the rightmost position and the third and the fourth position from the right. This returns (2^0)+(2^2)+(2^3), or 13. =BITOR(12,3) returns 15. The binary equivalent of 12 is 1100, and the binary equivalent of 3 is 11 (which can also be represented as 0011); the bits include 1 in all 4 positions of each value. This returns (2^0)+(2^1)+(2^2)+(2^3), or 15. |