7.12 Special Function Instructions
7.12.6 TAN operation on floating-point data (double precision)
7-239
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
TA
N
D
TAND
O
peration Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON,
and the corresponding error code is stored to SD0.
• The value of the specified data is not within the following range.
(Error code: 4140)
0, 2
-1022
| value of the specified data | < 2
1024
• The value of the specified data is 0.
(Error code: 4140)
• The operation result exceeds the following range. (An overflow occurs.)
2
1024
| operation result |
(Error code: 4141)
Program Example
(1) In the following program, the tangent function is evaluated on the angle set in BCD 4 digits in
the devices from X20 to X2F, and the result is stored to Var_D0 as a 64-bit floating-point real
number.
[Structured ladder]
[ST]
IF SM400 THEN
BIN(TRUE,K4X20,Var_D30);
FLTD(TRUE,Var_D30,Var_D20);
RADD(TRUE,Var_D20,Var_D10);
TAND(TRUE,Var_D10,Var_D0);
END_IF;
[Operation example when the value of 135 is specified for X20 to X2F]
I
nputs
the
ang
l
e
d
ata
on
wh
i
ch
the
tangent
funct
i
on
i
s
eva
l
uate
d. ( )
Converts
the
i
nput
ang
l
e
d
ata
to
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
d
ata
. ( )
Converts
d
egrees
to
ra
di
ans
. ( )
T
angent
operat
i
on
on
the
converte
d
ang
l
e
d
ata
i
n
ra
di
ans
. ( )
1
2
3
4
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
T
A
N
operat
i
on
4
Ra
di
an
convers
i
on
3
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
Var
_
D10
Var
_
D0
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
Var
_
D20
Var
_
D30
b15
---
b0
T
A
N
D
Fl
oat
i
ng
-
po
i
nt
convers
i
on
2
FLT
D
B
IN
convers
i
on
1
B
IN
RADD
2
.
35619
4
-
1
.
000000
135
135
BCD
va
l
ue
X2
F ---
X20
0 1 3 5
BCD
va
l
ue
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......