Publication 1766-RM001A-EN-P - October 2008
Math Instructions
215
Instruction Operation
When the rung is true, this instruction shall compute cosine of the Source
(in radians) and place the result in Destination. If the Destination is
floating point, the result shall always be rounded using the round to even
rule.
MATH FLAGS EFFECTS
•
Carry: shall be reset.
•
Overflow: shall be set if the result is infinity, or NAN, otherwise
reset.
•
Zero: shall be set if the lower 31 bits of float result are all zero
(handles negative zero), otherwise reset.
•
Sign: shall be set if the most significant bit of Destination is set (bit
31 for float), otherwise reset.
The Math Overflow Trap Bit shall ONLY be set if the Overflow bit is set.
Otherwise, it remains in last state.
COS Instruction Operation
Inputs
Conditions
Output
Source Type
Destination Type
S:2/14
S:0/3-0
S, Z, V, C
S:5/0
Destination
W,DW, F
F
X
Cos(Source) > 0
0,0,0,0
L
Cos(Source)
(1)
DNRM
X
X
X
0,1,0,0
L
1
W,DW, F
F
X
Cos(Source) < 0
1,0,0,0
L
Cos(Source)
W,DW, F
W, DW
X
Cos(Source) >= 0.5
0,0,0,0
L
1
W,DW, F
W, DW
X
-0.5 < Cos(Source) < 0.5
0,1,0,0
L
0
W,DW, F
W, DW
X
Cos(Source) <= 0.5
1,0,0,0
L
-1
(2)
X
F
X
Source is NAN or INF
0,0,1,0
1
0x7FFFFFFF
(3)
X
W
X
Source is NAN or INF
0,0,1,0
1
32767
(3)
X
DW
X
Source is NAN or INF
0,0,1,0
1
2147483647
(1) All denormalized inputs shall be treated as plus zero. Any underflow result shall produce plus zero.
(2) If the Destination is floating point, all overflows(Source is NAN or infinity) shall produce NAN(0x7FFFFFFF).
(3) If the Destination is word or double-word, overflow occurs, a saturated result is stored in Destination. Destination shall be 32767 for Word and 2147483647 for Double
Word.
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive