This Chapter provides a full explanation of using standard mathematical and trigonometric functions, as well an insight into how AMOS Professional exploits numbers.

**Arithmetical calculations**

Nothing could be simpler than asking AMOS Professional to run this sum:

D> Print 2+2

Arithmetical operations are straightforward, provided the correct symbols are used, as follows:

+ the plus sign always signals addition

- the minus sign is used for subtraction

* for multiplication, an asterisk character must be used

/ divisions are made using the forward-slash symbol

^ the circumflex character is used as the exponential symbol, and it means "raise this number to a given power", which is exactly the same as multiplying a number with itself.

So the following two lines are interchangable:

D> Print 3^5 Print 3*3*3*3*3

The following logical operations can also be used in calculations:

**MOD** is the "modulo" operator, which acts as a constant multiplier.
**AND**, **OR** and **XOR** are the three logical operations.

**Calculation priorities**

Arithmetical instructions are taken literally, using a set of built-in priorities. So the
following lines give the results 6 and 8 respectively:

D> Print 2+2*2 Print (2+2)*2

AMOS Professional handles a combination of calculations that make up an "expression" in the following strict order of priority:

- exponential numbers are always calculated first ( ^ ).
- multiplications and divisions are then calculated in order of appearance, from left to right (*/). Remainders of divisions will be dealt with by any modulo operations (MOD).
- additions and subtractions are calculated last, again in order, from left to right (+-).
- any logical operations will not be taken into account until after all the above calculations have been completed (AND, OR, XOR).

Any calculation placed inside a pair of round brackets is evaluated first, and treated as a single number.