5.3 Standard Arithmetic Functions
5.3.3 Subtraction
5-129
5
APPLICATION
FUNCTIONS
SUB(_E)
SUB(_E)
(3) If an underflow/overflow occurs in the operation result, data is output from as follows.
(a) Word (signed) type data
No operation error occurs even if an underflow/overflow occurs.
In case of SUB_E, TRUE is output from ENO.
(b) Double word (signed) type data
No operation error occurs even if an underflow/overflow occurs.
In case of SUB_E, TRUE is output from ENO.
Operation result
(1) Function without EN/ENO
An operation is executed and the operation value is output from .
(2) Function with EN/ENO
The following table shows the executing conditions and operation results.
*1 When FALSE is output from ENO, the data output from is undefined.
In this case, create a program so that the data output from is not used.
32767− (−2)=−32767 Since the highest-order bit is 1, the result
value is negative.
(7FFF
H) (FFFEH) (8001H)
−32767 − 2 = 32766 Since the highest-order bit is 0, the result
value is positive.
(8000
H) (0002H) (7FFEH)
2147483647 − (−2) = −2147483647 Since the highest-order bit is 1, the result
value is negative.
(7FFFFFFF
H) (FFFEH) (80000001H)
−2147483648 − 2 = 2147483646 Since the highest-order bit is 0, the result
value is positive.
(80000000
H) (0002H) (7FFFFFFEH)
EN ENO
TRUE (Operation execution) TRUE Operation output value
FALSE (Operation stop)
FALSE
*1
Undefined value
d
d
d
d
d