505
COSD, COSDP
1
2
3
4
4
6
7
8
7.12
Special function
instructions
7.12.4
C
OSD, COSDP
F
unct
i
on
(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.
Operat
i
on
E
rror
(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
E
xamp
l
e
(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
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
S
+
2
S
S
+
1
S
+
3
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
D
+
2
D
D
+
1
D
S
I
nputs
an
ang
l
e
used
for
COS
operat
i
on
(
)
.
Con
v
erts
the
i
nput
ang
l
e
i
nto
a
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
(
)
.
Con
v
erts
the
con
v
erted
ang
l
e
i
nto
a
rad
i
an
v
a
l
ue
(
)
.
E
xecutes
COS
operat
i
on
us
i
ng
the
con
v
erted
rad
i
an
v
a
l
ue
(
)
.
1
2
3
4
Step
I
nstruct
i
on
De
vi
ce