Arithmetic Operations in APT Program
Arithmetic operations can be carried out inside an APT program anywhere required. The normal rules of arithmetic as used in computer programming languages will be valid. The numbers can be specified directly as real numbers with decimal places. The arithmetic operators allowed are
Addition +
Subtraction -
Multiplication *
Division /
and
Exponentiation **
When carrying out the arithmetic operations the following priorities are applied:
Priority
1 ( )
2 **
3 *, /
4 +, -
In addition to the normal arithmetic operations, it is possible to do some calculations using special functions as follows :
ABSF Absolute value
ASINF Angle of the sine in degrees
ACOSF Angle of the cosine in degrees
ATANF Angle of the tangent in degrees
COSF Cosine of the angle in degrees
EXPF Exponential, the value of the e to the power
LOGF Natural logarithm
LOG10F Logarithm to the base 10
SQRTF Square root
SINF Sine of the angle in degrees
TANF Tangent of the angle in degrees
This will allow for any advanced calculations using these functions. Any calculations that are required in a block can be specified using all the above functions and operators, very similar to the normal algebraic operations. Some examples are given below:
Normal arithmetic APT
BA = 5 (4 + 2) BA = 5 * (4 + 2)
BB = 23 BB = 2 ** 3
BC = 1+2+5 BC = (1 + 2 + 5) / 4
4
CB = √ 14.2 + 36 * 12 CB = SQRTF (14.2 + 36 * 12)
CC = e (A * 34 - 32 *| C - D|) CC = EXPF ((A * 34 - 32 * ABSG (C - D))