NExS supports all the arithmetic, boolean and logical
operators available in the C programming language. It
does not support the C address operators or the operators
that have side effects, such as ++
. NExS provides two
operators, exponentiation (**
) and percent (%
), that are
not available in the C language.
NExS Formulas can contain the following operators to define relationship between values.
Operator | Precedence | Definition |
% | 14 | Unary percent |
** | 13 | Exponentiation |
+ | 12 | Unary plus |
- | 12 | Unary minus |
~ | 12 | Bitwise complement (integer) |
! | 12 | Logical not |
* | 11 | Multiplication |
/ | 11 | Division |
% | 11 | Remainder (integer) |
+ | 10 | Addition |
- | 10 | Subtraction |
<< | 9 | Shift left (integer) |
>> | 9 | Shift right (integer) |
< | 8 | Less Than |
> | 8 | Greater Than |
<= | 8 | Less Than or Equal |
>= | 8 | Greater Than or Equal |
== | 7 | Equal |
!= | 7 | Not Equal |
& | 6 | Bitwise And, or String Concatenation |
^ | 5 | Bitwise Exclusive-Or (integer) |
| | 4 | Bitwise Or |
&& | 3 | Logical And |
|| | 2 | Logical Or |
?: | 1 | Conditional |
In formulas with more than one operator, NExS evaluates operators in the order of precedence presented above, with highest precedence first. That is, AND/OR/NOT operators are evaluated after inequality operators in a logical expression, and multiplication/division operations are performed before subtraction/addition operations in an arithmetic expression. Operators at the same precedence level are evaluated from left to right.
The precedence of operators can be overridden by using parentheses to explicitly specify the order of evaluation.
Here are some special notes about NExS operators:
&
operator performs double duty: as a bit-wise
``and'' if the operands are numbers or as a string
concatenation operator joining two strings together if
the operands are text.
%
operator also performs double duty: as the
``percent'' operator when appended to a number or
numeric expression, or as the C-style ``modulus''
operator when applied between two integer expressions.
==
and <
) can be used to
compare text strings lexically (alphabetically).
=@SUM(A1 ? B1..C20 : C10..D15)