Appendix I. Number Representation and Instruction-Use Examples
Number RepresentationFIXED-POINT WITH TWO'S COMPLEMENT
A fixed-point number is a signed value, recorded as a binary
integer. It is called fixed-point because the programmerde termines the fixed positioning of the radix point.
Fixed-point operands may be recorded in halfword (16-
bit) or word (32-bit) lengths. In bothlen-gths, the first bit
position (0) holds the sign of the number, with the remaining
bit positions (1-15 for halfwords and 1-31 for fullwords)
used to designate the magnitude ofthe number.
Positive fixed-poirit numbers are in true binary
form with a zero sign bit. Negative fixed-point numbers are
represented in two's-complement notation with a one bit in
the sign position. InaU cases, the bits between the sign bit
and the leftmost significant bit of the integer are the same
as the sign bit (that is,311 zeros for positive numbers, ql1 ones for negative numbers).
Negative fixed-point numbers are formed intwo's-comple ment notation by inverting each bit of the positive binary
number and adding one. For example, the true binary form
of the decimal value (+26) is made negative (-26) in the
following manner:
+26
Invert
Add 1
-26
S Integer
o000 0000 0001 1010 1 111 1111 1110 0101 1
111 11111110 0110 (Two's-complement
form)
This is equivalent to subtracting the number0000 0000 0001 1010 from
10000 0000 0000 0000 The following addition examples illustrate two's-comple ment arithmetic. Only eight bit positions are used. All
negative numbers are in two's-complement form.
1.
2.
3.
+57
+35
+92
+57
-35
+22
+35
-57
-220011 1001 0010 0011 0101 1100 0011 1001 1101 1101 No overflow. 0001 0110 Ignore carry-carry into high-order
position and carry out.0010 001l 1100 0111 1110 1010 Sign change only; no carry
4. -571100 0111 -35 1101 1101 No overflow.
-921010 0100 Ignore carry-carry into high-order
position and carry out.
5. -57 =1100 0111 -92 = 1010 0100 -149 = *0110 1011 *Overflow-no carry into high-order
position but carry out.
6. +570011 1001 +92 0101 1100 149 = *1001 0101 *Overflow-carry into high-order
position, no carry out.
The presence or absence of an overflow condition may be
recognized by the condition of the carries.• There is no overflow:
a. If there is a carry into the high-order bit position and
also a carry out 2 and 4).
b. If there is no carry into the high-order bit position
and no carry out (examples 1 and 3).• There is an overflow:
a. If there is no carry into the high-order position but
there is a carry out (example 5).
b. If there is a carry into the high-order position but no
carry out (example 6).
The following are 16-bit fixed-point numbers. The first is
the largest 16-bit positive number and the last, the largest
16-bit negative number.
Number
2
15
- 12° o
-2° _ 215
Decimal
32,767
1
o
-1
= -32,768
S Integer
o 111 1111 1111 1111
o000 0000 0000 0001 o 000 0000 0000 0000 1 111 1111 1111 1111
1000 0000 0000 0000 The following are 32-bit fixed-point numbers. The first is
the largest positive number that can be represented by 32
bits, and the last is the largest negative number that can be
represented by 32 bits.
Number o
Decimal 5 Integer
2147483647 =0 111 1111 1111 1111 1111 1111 1111 1111
65 536 =0 000 0000 0000 0001 0000 0000 0000 0000 1 = 0 000 0000 0000 0000 0000 0000 0000 0001 o = 0 000 0000 0000 0000 0000 0000 0000 0000 -1 = 1 111 1111 1111 1111 1111 1111 1111 1111
_21 -2= 11111111111111111111111111111110
_2
16
-65536=11111111111111110000000000000000 _2
3i
+1 =-2147483647=1000000000000000 0000 0000 0000 0001 = -2147483648 = 1 000 0000 0000 0000 0000 0000 0000 0000 Appendix I. Number Representation and Instruction-Use Examples 289
Number Representation
A fixed-point number is a signed value, recorded as a binary
integer. It is called fixed-point because the programmer
Fixed-point operands may be recorded in halfword (16-
bit) or word (32-bit) lengths. In both
position (0) holds the sign of the number, with the remaining
bit positions (1-15 for halfwords and 1-31 for fullwords)
used to designate the magnitude of
Positive fixed-poirit numbers are
form with a zero sign bit. Negative fixed-point numbers are
represented in two's-complement notation with a one bit in
the sign position. In
and the leftmost significant bit of the integer are the same
as the sign bit (that is,
Negative fixed-point numbers are formed in
number and adding one. For example, the true binary form
of the decimal value (+26) is made negative (-26) in the
following manner:
+26
Invert
Add 1
-26
S Integer
o
111 1111
form)
This is equivalent to subtracting the number
1
negative numbers are in two's-complement form.
1.
2.
3.
+57
+35
+92
+57
-35
+22
+35
-57
-22
position and carry out.
4. -57
-92
position and carry out.
5. -57 =
position but carry out.
6. +57
position, no carry out.
The presence or absence of an overflow condition may be
recognized by the condition of the carries.
a. If there is a carry into the high-order bit position and
also a carry out
b. If there is no carry into the high-order bit position
and no carry out (examples 1 and 3).
a. If there is no carry into the high-order position but
there is a carry out (example 5).
b. If there is a carry into the high-order position but no
carry out (example 6).
The following are 16-bit fixed-point numbers. The first is
the largest 16-bit positive number and the last, the largest
16-bit negative number.
Number
2
15
- 1
-
Decimal
32,767
1
o
-1
= -32,768
S Integer
o 111 1111 1111 1111
o
1
the largest positive number that can be represented by 32
bits, and the last is the largest negative number that can be
represented by 32 bits.
Number
Decimal 5 Integer
2147483647 =
65 536 =
_21 -2= 11111111111111111111111111111110
_2
16
-65536=
3i
+1 =-2147483647=








































































































































































































































































































































