AND Functions
The AND functions create a result by combining each bit of one number with the corresponding bit of the other number. If a pair of corresponding bits are both 1, the result for that bit position is 1; otherwise the result is 0, as shown in the table.
|
AND |
arg1 |
||
|
0 |
1 |
||
|
arg2 |
0 |
0 |
0 |
|
1 |
0 |
1 |
|
Sample Syntax
INT1AND(arg1, arg2)
Remarks
| • | The AND functions are commutative; that is, the order of the arguments does not affect the outcome. |
Examples
|
Function Input |
Result |
Comments |
|
INT1AND(0,x) |
0 |
0 ANDed with any integer returns 0. |
|
INT1AND(-0,x) |
0 |
-0 is mapped to 0 before ANDing it with the other argument. |
|
INT1AND(-64,64) |
64 |
|
|
INT1AND(-64,66) |
64 |
|
|
INT1AND(-1,127) |
127 |
-1 is represented by all 1-bits, so it returns any number it is ANDed with. |
|
INT1AND(-128,-x) |
-128 |
-128 ANDed with any negative integer (except -0) returns -128. |