4 OPERATION CONTROL PROGRAMS
4.1 Operation Control Programs
121
4
Internal operation data types
For internal operations, when (S1) and (S2) differ in data type, the data of the smaller type is converted into that of the greater
type before operation is performed. If the operation result is over the range of processed number in each type, an overflow will
occur. However, an operation error will not occur. By converting the set data with the type converting instruction, an overflow
may be able to be prevented.
The data type combinations, and internal operation data types for binary operations are shown below.
*1 Except the operator "%"
■Program example
• Program which substitutes the result of multiplying #0 by #10 to W0L
Since both of set data are the 16-bit integer type, the multiplier result is processed by the 16-bit integer type. An overflow
occurs, and the lower 16-bit of the multiplier result is the operation result.
• Program which substitutes the result of multiplying #0 and #10 to W0L after converting into the 32-bit integer type
Since the multiplier result is processed with the 32-bit integer type by the type converting instruction, even if the device value
is the same as the program example above (Program which substitutes the result of multiplying #0 by #10 to W0L), an
overflow will not occur.
(S1) data type (S2) data type Internal operation data type
16-bit integer type 16-bit integer type 16-bit integer type
32-bit integer type 32-bit integer type
64-bit floating-point type
*1
64-bit floating-point type
*1
32-bit integer type 16-bit integer type 32-bit integer type
32-bit integer type
64-bit floating-point type
*1
64-bit floating-point type
*1
64-bit floating-point
type
16-bit integer type 64-bit floating-point type
*1
32-bit integer type
64-bit floating-point type
*1
(S1) Operator (S2)
The operators are "+, -, *, /, %"
678
*
W0L
W1 W0
(H02A6)
#0
(H3039)
W0L = #0*#10
-18698
(HB6F6)
←
(H7FB6F6)
#10
12345
678
*
W0L 8369910
W1 W0
(H007FB6F6)
(H000002A6)
LONG(#0)
(H00003039)
LONG(#10)
W0L = LONG(#0)*LONG(#10)
12345