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>
(Higher than the maximum value is overflow)
Unsigned Signed
Maximum
value
U65535 HFFFF K32767 H7FFF
⁞ ⁞ ⁞ ⁞
U32768 H8000 K 1 H1
U32767 H7FFF K 0 H0
⁞ ⁞ K -1 HFFFF
U 1 H1 ⁞ ⁞
Minimum
value
U 0 H0 K-32768 H8000
(Lower than the minimum value is underflow)
<32-bit operation>
(Higher than the maximum value is overflow)
Unsigned Signed
Maximum
value
U4294967295 HFFFFFFFF K2147483647 H7FFFFFFF
⁞ ⁞ ⁞ ⁞
U2147483648 H80000000 K 1 H1
U2147483647 H7FFFFFFF K 0 H0
⁞ ⁞ K -1 HFFFFFFFF
U 1 H1 ⁞ ⁞
Minimum
value
U 0 H0 K-2147483648 H80000000
(Lower than the minimum value is underflow)
■
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.
2.10 Overflow and Underflow
WUME-FP7CPUPGR-12 2-49