Yaskawa MP900 Series Ladder Programming Manual User Manual

Page 98

Advertising
background image

5.3 Numeric Operation Instructions

5.3.4 Subtract (SUB (

−))

5-29

Instructions

5

• Storing the Output Data in MW00000 When Input Data A Is 10.5 and Input Data B Is 10

10.5 – 10

→ MW00000 = 0 (when truncating below the decimal point is set)

• Storing the Output Data in ML00000 When Input Data A in MW00002 Is -20,000 and Input Data B in

MW00003 Is 30,000
-20,000 – 30,000

→ ML00000 = -32,768*

∗ In the example given above, an underflow error occurs because both input data A and B are integers, which

limits the result to a number within the range for integers.

( 4 ) Additional Information

With integer operations, an overflow operation error occurs if the result exceeds 32,767 and an underflow operation
error occurs if the result is less than -32,768.
With double-length integer operations, an overflow operation error occurs if the result exceeds 2,147,483,647 and an
underflow operation error occurs if the result is less than -2,147,483,648.

When performing operations with different data types, the result of the operation will depend on the data type of the output reg-
ister.
Refer to 4.4.2 ( 3 ) Precautions When Using Local Registers within a User Function for details.
Normally, addition and subtraction instructions (+, –, ++, and – –) involving double-length integers are performed as 32-bit
operations.
However, these instructions are performed as 64-bit operations if they are used to correct the remainder produced by an immedi-
ately preceding MUL instruction (

×) and are immediately followed by a DIV instruction (÷).

INFO

Advertising
This manual is related to the following products: