7.12 Special Function Instructions
7.12.12 TAN
-1
operation on floating-point data (double precision)
7-253
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
ATA
N
D
ATAND
O
peration Error
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 device is not within the following range.
(Error code: 4140)
0, 2
-1022
| value of the specified device | < 2
1024
• The value of the specified device is 0.
(Error code: 4140)
• The operation result exceeds the following range. (An overflow occurs.)
2
1024
| operation result |
(Error code: 4141)
Program Example
In the following program, the arctangent function is evaluated on the 64-bit floating-point real
number in Var_D0, and its angle is output to Y40 to Y4F in BCD 4 digits.
[Structured ladder]
[ST]
IF SM400 THEN
ATAND(TRUE,Var_D0,Var_D10);
DEGD(TRUE,Var_D10,Var_D20);
INTD(TRUE,Var_D20,Var_D30);
BCD(TRUE,Var_D30,K4Y40);
END_IF;
[Operation example when the value of 1 is set for Var_D0]
O
utputs the angle
d
ata converte
d
to integer value to
the
d
isplay.
(
)
Converts the angle
d
ata in 64-bit floating-point real
number to integer value.
(
)
Converts ra
d
ians to
d
egrees.
(
)
Evaluates the angle
d
ata
(
in ra
d
ians
)
by the
arctangent operation.
(
)
1
2
3
4
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
BCD
operat
i
on
4
Ang
l
e
convers
i
on
2
B
IN
convers
i
on
3
Var
_
D20
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
Var
_
D10
Var
_
D30
b15
---
b0
INT
D
BCD
T
A
N
-
1
convers
i
on
1
A
T
A
N
D
D
E
GD
4
5
0
.
785398
6
4-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
Var
_
D0
1
4
5
B
IN
va
l
ue
Y4F --- Y4
0
0 0
4
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: ......