Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual
Page 84
Operating Functions
Chapter 5
5–47
5.5.2.3.2 COS([expr])
Returns the cosine of the argument. The argument is expressed in radians.
Calculations are carried out to 7 significant digits. The argument must be
between
" 200000.
Examples:
uPRINT COS(PI/4)
uPRINT COS(0)
.7071067
1
5.5.2.3.3 TAN([expr])
Returns the tangent of the argument. The argument is expressed in radians.
The argument must be between
"200000.
Examples:
uPRINT TAN(PI/4)
uPRINT TAN(0)
1
0
5.5.2.3.4 ATN([expr])
Returns the arctangent of the argument. The result is in radians.
Calculations are carried out to 7 significant digits. The ATN operator
returns a result between –PI/2 (3.1415926/2) and PI/2.
Examples:
uPRINT ATN(PI)
uPRINT ATN(1)
1.2626272
.78539804
5.5.2.4
Comments on Trig Functions
The SIN, COS and TAN operators use a Taylor series to calculate the
function. These operators first reduce the argument to a value between 0
and PI/2. This reduction is accomplished by the following equation:
reduced argument = (user arg/PI – INT(user arg/PI)) * PI
The reduced argument, from the above equation, is between 0 and PI. The
reduced argument is then tested to see if it is greater than PI/2. If it is, then
it is subtracted from PI to yield the final value. If it is not, then the reduced
argument is the final value.
5.5.2
Unary Operators
(continued)