3.1 Arithmetic Logic & Statements
3.1.1 Binary Operators
Binary operators only appear inside expressions.
There are:
- Mathematical operations: addition (
+
), subtraction (-
), multiplication (*
), and division (/
), modulus operation (MOD
) and power operation (**
) - Logical operations: non-exclusive or (
OR
), exclusive or (XOR
), and logical and (AND
) - Relational operators: equality (
EQ
), inequality (NE
), strictly greater than (GT
), greater than or equal to (GE
), strictly less than (LT
), and less than or equal to (LE
) - Bitwise logical operators: non-exclusive bitwise or (
|
), exclusive bitwise or (^
), and logical bitwise and (&
)
Their precedence is defined accordingly to the following table
Operators | Precedence |
---|---|
** | Highest |
* / MOD | |
+ - | |
EQ NE GT GE LT LE | |
AND OR XOR & | ^ | Lowest |
About equality and floating-point values
The RS274/NGC language only supports floating-point values of finite precision. The interpreter considers values equal if their absolute difference is less than 0.0001.
3.1.2 Functions
The following table shows the available functions.
Unary operations arguments which take angle measures ( COS
, SIN
, and TAN
) are in degrees.
Values returned by unary operations which return angle measures ( ACOS
, ASIN
, and ATAN
) are also in degrees.
Function Name | Result |
---|---|
ATAN[arg]/[arg] | Four quadrant inverse tangent. |
ABS[arg] | Absolute value. |
ACOS[arg] | Inverse cosine. |
ASIN[arg] | Inverse sine. |
COS[arg] | Cosine. |
EXP[arg] | e raised to the given power. |
FIX[arg] | Round down to integer. |
FUP[arg] | Round up to integer. |
ROUND[arg] | Round to nearest integer. |
LN[arg] | Base-e logarithm. |
SIN[arg] | Sine. |
SQRT[arg] | Square Root. |
TAN[arg] | Tangent. |
EXISTS[arg] | Check if a named parameter exists. Returns 1 if it exists otherwise returns 0. |