Arithmetic Operators

Definition

The arithmetic operators perform addition, subtraction, multiplication, division, exponentiation, and modulus operations.

Addition + Adds one operand to the other
Subtraction - Subtracts the second operand from the first
Multiplication * Multiplies one operand by the other
Division / Divides the first operand by the second
Modulo % Divides the first INTEGER operand by the second, and returns the remainder
Exponentiation ** Lets you refer to a number in terms of a base value and an exponent

Operand Type

Operands for the arithmetic operators can be integers or real numbers.

Arithmetic Operators with Sets

The plus (+) and minus (-) operators are valid operators for sets. The plus operator is the equivalent of the SetUnion and SetAddMember functions; it performs the union of two sets:

SuperSet = SubSetA + SubSetB

SuperSet contains all members of both subsets with no duplicates. If either of the subsets is a single member, then the plus operator is the equivalent of the SetAddMember function.

The minus operator is the equivalent of the SetExclude and SetRemoveMember functions; it performs the exclusion of two sets, either of which could be a single member:

SubSet = SuperSetA - SuperSetB
SubSet is the set containing all members of SuperSetA that are not also contained in SuperSetB.
Note: The exclusion of set B from set A is equivalent to: SetIntersection (A, SetComplement (B)).

The following examples should make the behavior of set exclusion operations more clear:

Operation Resulting set
Red - [COLORS]{Green, Blue} Red
Red - [COLORS]{Red, Green, Blue} empty set
[COLORS]{Red, Green, Blue} - Red {Green, Blue}

In the third example above, the specification of a single member as the right operand works like the SetRemove function to remove that member from the left operand set.