Reference Manual

Turbo PMAC/PMAC2 Software Reference
Turbo PMAC Mathematical Features 494
SQRT
Function: Square root
Syntax: SQRT({expression})
Domain: Non-negative real numbers
Domain units: User-determined
Range: Non-negative real numbers
Range units: User-determined
SQRT implements the positive square-root function of the mathematical expression contained inside the
following parentheses.
If the argument inside the parentheses is outside of the legal domain of non-negative numbers, an
arbitrary value will be returned. No error will be reported, and the program will not stop. It is the
programmer’s responsibility to check for possible domain errors.
Execution time, 80 MHz CPU: 3.7 µsec interpreted, 1.4 µsec compiled
Examples:
P19=SQRT(P20) ; Takes the square root of P20
P50=SQRT(P8*P8+P9*P9) ; Pythagorean theorem calculation
TAN
Function: Trigonometric tangent
Syntax: TAN({expression})
Domain: All real numbers except +/-(2N-1)*90 degrees
Domain units: Radians/degrees
Range: All real numbers
Range units: none
TAN implements the trigonometric tangent function of the mathematical expression contained inside the
following parentheses.
This function interprets its argument in degrees if I15 is set to the default value of 0; it interprets its
argument in radians if I15 is set to 1.
If the argument inside the parentheses approaches +/-(2N-1)*90 degrees (+/-90, 270, 450, etc.), the TAN
function will blow up and a very large value will be returned. If the argument inside the parentheses is
exactly equal to one of these quantities, an internal division-by-zero error will occur and the resulting
value will saturate at +/-2
47
. No error will be reported, and the program will not stop. It is the
programmer’s responsibility to check for possible domain errors.
Execution time, 80 MHz CPU: 6.8µsec interpreted, 4.5 µsec compiled
Examples:
P60=TAN(30) ; Computes cosine of 30
Y(Q80*TAN(Q81)) ; Move Y axis to calculated value