2.10 Overflow and Underflow
■
What are overflow and underflow?
● A value resulting from operation instruction sometimes fails to satisfy the range that can be
handled.
● When a value is larger than the maximum value it is called "overflow" and when a value is
lower than the minimum value it is called "underflow".
■
Overflow and underflow in binary operations
● If numerical values go beyond the range shown below, those values become overflow or
underflow.
<16-bit operation>
Maximum
value
Minimum
value
<32-bit operation>
Maximum
value
Minimum
value
■
Values for overflow and underflow
● As shown in the figures, the numerical values that can be handled by an operation are in a
loop status, in which the maximum value and minimum value are connected.
WUME-FP7CPUPGR-12
(Higher than the maximum value is overflow)
Unsigned
U65535
⁞
U32768
U32767
⁞
U 1
U 0
(Lower than the minimum value is underflow)
(Higher than the maximum value is overflow)
Unsigned
U4294967295
⁞
U2147483648
U2147483647
⁞
U 1
U 0
(Lower than the minimum value is underflow)
2.10 Overflow and Underflow
HFFFF
⁞
H8000
H7FFF
⁞
H1
H0
HFFFFFFFF
K2147483647
⁞
H80000000
H7FFFFFFF
⁞
H1
H0
K-2147483648
Signed
K32767
⁞
K 1
K 0
K -1
⁞
K-32768
Signed
H7FFFFFFF
⁞
K 1
K 0
K -1
HFFFFFFFF
⁞
H80000000
H7FFF
⁞
H1
H0
HFFFF
⁞
H8000
⁞
H1
H0
⁞
2-49