44
PROSEC T3H
2. Expanded Functions
2.4.1 Double-word multiplication and division (D
∗∗∗∗////
)
FUN 042
D
∗
/
Double-word multiplication and division
Expression
Input
─
[
A+1
⋅
A
D
∗
/
B+1
⋅
B
→
C+1
⋅
C
]
─
Output
Function
When the input is ON, the data of
A+1
⋅
A
is multiplied by the data of
B+1
⋅
B
, and the product is divided by
B+3
⋅
B+2
, then the quotient is stored in
C+1
⋅
C
and the remainder in
C+3
⋅
C+2.
The data range is -2147483648 to 2147483647. If the result (quotient) is out of the data range, the following
limit value is stored.
Positive overflow: quotient = 2147483647, remainder = 0
Negative overflow: quotient = -2147483647, remainder = 0
Execution condition
Input Operation Output
ERF
OFF No
execution
OFF
−
ON
B+3
⋅
B+2
≠
0, no overflow
Normal execution
ON
−
B+3
⋅
B+2
≠
0, overflow
Limit
ON
ON
B+3
⋅
B+2
=
0
No execution
OFF
ON
Operand
Name
Device
Register
Con-
Index
X Y S L R Z T. C. I O X
W
Y
W
S
W
L
W
R
W
W T C D F I
W
O
W
I J K
stant
A
Operation
data
√
√
√
√
√
√
√
√
√
√
√
√
B
Multiplier,
divisor
√
√
√
√
√
√
√
√
√
√
√
C
Result
√
√
√
√
√
√
√
√
√
√
Example
When R0200 is ON, the double-word data of D0351
⋅
D0350 is multiplied by the data of D0262
⋅
D0261,
and the product is divided by the data of D0264
⋅
D0263, then the quotient is stored in D0401
⋅
D0400 and
the remainder in D0403
⋅
D0402.