Operators

10. Custom Macro

Operators

Macro Operators

Operators allow mathematical calculations, logical comparisons, and data manipulations in macros.

Arithmetic Operators

Operator Function Example
+Addition#1 = #2 + #3
-Subtraction#1 = #2 - #3
*Multiplication#1 = #2 * #3
/Division#1 = #2 / #3
MODModulo (remainder)#1 = #2 MOD #3

Mathematical Functions

Function Description Example
SIN[x]Sine (degrees)#1 = SIN[45]
COS[x]Cosine (degrees)#1 = COS[45]
TAN[x]Tangent (degrees)#1 = TAN[45]
SQRT[x]Square root#1 = SQRT[100]
ABS[x]Absolute value#1 = ABS[-5]
ROUND[x]Rounding#1 = ROUND[3.7]

Comparison Operators

Operator Meaning
EQEqual to (=)
NENot equal (≠)
GTGreater than (>)
GEGreater or equal (≥)
LTLess than (<)
LELess or equal (≤)

Logical Operators

  • AND: Logical AND
  • OR: Logical OR
  • XOR: Exclusive OR

Examples

; Calculate radius from coordinates
#10 = SQRT[[#1*#1] + [#2*#2]]

; Calculate angle
#11 = ATAN[#2]/[#1]

; Compound condition
IF [[#1 GT 0] AND [#1 LT 100]] GOTO 10