Logic
Logic functions provide Boolean algebra and conditional testing capabilities to the In-Sight spreadsheet. All bitwise functions perform the corresponding logical operation on each bit position in the binary representation of the arguments and return the resulting binary number in decimal form. For example, bit 0 of Value0 is compared to bit 0 of Value1, bit 1 of Value0 is compared to bit 1 of Value1, and so on.
| Operator | Symbol |
|---|---|
| NOT | ! |
| AND | && |
| OR | || |
| Equivalent to | == |
| Not equal to | <> (or !=) |
For all Logic functions:
- FALSE = 0
- TRUE = any non-zero result
|
Function |
Description |
||||||||||||||||||||||||||||||||||||
|
And(Value1, Value2, ...) |
Returns 1 if all values are non-zero.
(Logical AND Examples:
|
||||||||||||||||||||||||||||||||||||
|
BitAnd(Value1, Value2, ...) |
Returns the bitwise AND of values. Note: Processes and returns 32-bit signed integer values.
Examples: BitAnd(45, 77) returns 13. 45 = 0000 0000 0000 0000 0000 0000
0010 1101 in binary, Individually comparing each common bit in these two 16-bit binary numbers using the And operation yields 0000 0000 0000 0000 0000 0000 0000 1101, which = 13 in decimal. |
||||||||||||||||||||||||||||||||||||
|
BitNot(Value) |
Returns the bitwise inverse of Value. Note: Processes and returns 32-bit signed integer values.
Examples: BitNot(45) returns -46. 45 = 0000 0000 0000 0000 0000 0000 0010 1101 in binary. |
||||||||||||||||||||||||||||||||||||
|
BitOr(Value1, Value2, ...) |
Returns the bitwise OR of values. Note: Processes and returns 32-bit signed integer values.
Examples: BitOr(45, 77) returns 109. 45 = 0000 0000 0000 0000 0000 0000
0010 1101 in binary, Individually comparing each common bit in these two 16-bit binary numbers using the Or operation yields 0000 0000 0000 0000 0000 0000 0110 1101, which = 109 in decimal. |
||||||||||||||||||||||||||||||||||||
|
BitXor(Value1, Value2, ...) |
Returns the bitwise XOR (exclusive OR)
of Values. (Logical XOR Note: Processes and returns 32-bit signed integer values.
Examples: BitXor (45, 77) returns 96. 45 = 0000 0000 0000 0000 0000 0000
0010 1101 in binary, 0110 0000 are the only non-common bits between 45 and 77, as demonstrated below.
0110 0000 = 96 in decimal. |
||||||||||||||||||||||||||||||||||||
|
If(Cond, Value1, Value2) |
Returns Value1 if Cond is non-zero. Otherwise, it returns Value2. Note: If the condition
or the arguments reference empty cells, they are interpreted as a zero
(FALSE).
|
||||||||||||||||||||||||||||||||||||
|
InRange(Value, Start, End) |
Returns TRUE if Min(Start,End) ≤ Value ≤ Max(Start,End). |
||||||||||||||||||||||||||||||||||||
| InTolerance(Actual, Expected, Tolerance %, Margin) |
Determines if the Actual value is within the relative Tolerance % of the Expected value, provided that the difference between the Actual and Expected values is above the Margin. If the value of the calculated percentage difference is larger than the value of the Tolerance % or the Margin arguments, then the function returns 0. Otherwise, it returns 1. The calculated values use the Expected and Actual values provided. |
||||||||||||||||||||||||||||||||||||
|
Not(Value) |
Returns 0 if Value is non-zero, or 1 if Value is 0. (Logical Inverse) Examples:
|
||||||||||||||||||||||||||||||||||||
| OneShot(Value) |
Returns true (1) if the latest input value is true (non-zero) and the previous input value was false (0). In all other cases, the function returns false (0). Examples:
Note: Depending on trigger speed, OneShot function results can pulse very rapidly. This can mean that the output value does not visibly update in the display.
|
||||||||||||||||||||||||||||||||||||
|
Or(Value1, Value2, ...) |
Returns 0 if all values are zero. Otherwise,
it returns 1. (Logical OR Examples:
|
the result is TRUE when both values are TRUE.)