505
COSD, COSDP
1
2
3
4
4
6
7
8
7.12 Special function instructions
7.12.4 COSD, COSDP
Function
(1) The COS (cosine) value of the angle specified by is calculated and its result is stored into the device specified by .
(2) Angles designated at are set in radian units (degrees / 180).
For conversion between degrees and radian values, see the RADD and DEGD instructions.
(3) When the operation results in -0 or an underflow, the result is processed as 0.
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into
SD0.
Program Example
(1) The following program performs a COS operation on the angle data designated by the 4 BCD digits from X20 to X2F, and
stores results as 64-bit floating decimal point type real numbers at D0 to D3.
[Ladder Mode]
[List Mode]
Error
code
Error details
Q00J/
Q00/
Q01
QnH QnPH QnPRH QnU LCPU
4140
The specified device value is not within the following range:
0, 2
-102
| Specified device value | < 2
1024
The specified device value is -0.
–– –– –– ––
4141
The operation result exceeds the following range (when an overflow
occurs):
2
1024
| Operation result |
–– –– –– ––
S
D
COS (
)
+3
64-bit floating-point
real number
S
+2
S
S
+1
S
+3
64-bit floating-point
real number
D
+2
D
D
+1
D
S
Inputs an angle used for
COS operation ( ).
Converts the input angle into a
64-bit floating-point real number ( ).
Converts the converted angle
into a radian value ( ).
Executes COS operati
on using the
converted radian value ( ).
1
2
3
4
Step Instruction Device