A signed binary integer of either sign,
except for zero and the maximum negativenumber, can be changed to a number of
the same magnitude but opposite sign by
forming its two's complement. Forming
the two's complement of a number is
equivalent to subtracting the number
from zero. The two's complement of zero
is zero.
The two's complement of the maximum
negative number cannot be represented in
the same number of bits. When an opera
tion, such as LOADCOMPLEMENT, attempts
to produce the two's complement of the
maximum negative number, the result is
the maximum negative number, and a
fixed-paint-overflow exception is recog
nized. An overflow does not result,
however, when the maximum negative
number is complemented asan intermedi
ate result but the final result is
within the representable range. Anexample of this case is a subtraction of
the maximum negative number from -1.
The product of two maximum negative
numbers ofa given length is represent
able asa positive number of double that
length.
In discussions of signed binary integers
in this publication,a signed binary
integer includes the sign bit. Thus,
the expression "32-bit signedbinary integer" denotes an integer with 31
numeric bits and a sign bit, and the
expression "64-bit signed binary
integer" denotes an integer with 63
numeric bits and a sign bit.
In an arithmetic operation, a carry out
of the numeric field of asigned binary
integer is carried into the sign bit.
However,in algebraic left-shifting, the
sign bit does not changeeven if signif
icant numeric bitsare shifted out.
1. An alternate way of forming the
two's complement of a signed binary
integer is to invert all bits to
the left of the rightmost one bit,
leaving the rightmost one bit and
all zero bits to the right of it
unchanged.
2. The numeric bits of a signed binary
integer may be considered to repre
sent a positive value, with the
sign representing a value of either
zero or the maximum negative
number.BINARY ARITHMETIC
SIGNEDBINARY ARITHMETIC Addition and Subtraction
Addition of signed binary integers is
performed by adding all bits of each
operand, including the sign bits. When
one of the operands is shorter, the
shorter operand is considered to be
extended on the left to the length of
the longer operand by propagating the
sign-bit value.
Subtraction is performed by adding the
one's complement of the second operand
anda value of one to the first operand.
Fixed-Point Overflow
A fixed-point-overflow condition exists
for signed binary addition or
subtraction when the carry out of the
sign-bit position and the carry out of
the leftmost numeric bit position disa
gree. Detection of an overflow does not
affect the result produced by the addi
tion. In mathematical terms, signed
addition and subtraction produce a
fixed-point overflow whenthe result is
outside the range of representation for
signed binary integers. Specifically,
for ADD andSUBTRACT, which operate on
32-bit signed binary integers, there is
an overflow when the proper result would
be greater than or equal to +2
31
or less
than-2
31
• The actual result placed in
the general register after an overflow
differs from the proper result by232. A fixed-point overflow causes a program
interruption if allowed by the program
mask.
The instructions SHIFT LEFT SINGLE and
SHIFT LEFTDOUBLE produce an overflow
whenthe result is outside the range of
representation for signed binaryinte gers. The actual result differs from
that for addition and subtraction in
that the sign of the result remains the
same as the original sign.
UNSIGNEDBINARY ARITHMETIC
Addition of unsigned binary integers is
performed by adding all bits of each
operand. When one of the operands is
shorter, the shorter operand is consid
ered to be extended on the left with
zeros.Unsigned binary arithmetic is
used in address arithmetic for adding
the X,B, and D fields. (See the Chapter 7. General Instructions 7-3
except for zero and the maximum negative
the same magnitude but opposite sign by
forming its two's complement. Forming
the two's complement of a number is
equivalent to subtracting the number
from zero. The two's complement of zero
is zero.
The two's complement of the maximum
negative number cannot be represented in
the same number of bits. When an opera
tion, such as LOAD
to produce the two's complement of the
maximum negative number, the result is
the maximum negative number, and a
fixed-paint-overflow exception is recog
nized. An overflow does not result,
however, when the maximum negative
number is complemented as
ate result but the final result is
within the representable range. An
the maximum negative number from -1.
The product of two maximum negative
numbers of
able as
length.
In discussions of signed binary integers
in this publication,
integer includes the sign bit. Thus,
the expression "32-bit signed
numeric bits and a sign bit, and the
expression "64-bit signed binary
integer" denotes an integer with 63
numeric bits and a sign bit.
In an arithmetic operation, a carry out
of the numeric field of a
integer is carried into the sign bit.
However,
sign bit does not change
icant numeric bits
1. An alternate way of forming the
two's complement of a signed binary
integer is to invert all bits to
the left of the rightmost one bit,
leaving the rightmost one bit and
all zero bits to the right of it
unchanged.
2. The numeric bits of a signed binary
integer may be considered to repre
sent a positive value, with the
sign representing a value of either
zero or the maximum negative
number.
SIGNED
Addition of signed binary integers is
performed by adding all bits of each
operand, including the sign bits. When
one of the operands is shorter, the
shorter operand is considered to be
extended on the left to the length of
the longer operand by propagating the
sign-bit value.
Subtraction is performed by adding the
one's complement of the second operand
and
Fixed-Point Overflow
A fixed-point-overflow condition exists
for signed binary addition or
subtraction when the carry out of the
sign-bit position and the carry out of
the leftmost numeric bit position disa
gree. Detection of an overflow does not
affect the result produced by the addi
tion. In mathematical terms, signed
addition and subtraction produce a
fixed-point overflow when
outside the range of representation for
signed binary integers. Specifically,
for ADD and
32-bit signed binary integers, there is
an overflow when the proper result would
be greater than or equal to +2
31
or less
than
31
•
the general register after an overflow
differs from the proper result by
interruption if allowed by the program
mask.
The instructions SHIFT LEFT SINGLE and
SHIFT LEFT
when
representation for signed binary
that for addition and subtraction in
that the sign of the result remains the
same as the original sign.
UNSIGNED
Addition of unsigned binary integers is
performed by adding all bits of each
operand. When one of the operands is
shorter, the shorter operand is consid
ered to be extended on the left with
zeros.
used in address arithmetic for adding
the X,