DECIMAL INTEGERS
Decimal integers consist of one or more
decimal digits and a sign. Each digit
and the sign are represented by a 4-bit
code. The decimal digits are in
binary-coded decimal (BCD) form, with
the values 0-9 encoded as 0000-1001. The sign is usually represented as 1100 (C hex) for plus and 1101 (D hex) for
minus. These are the preferred sign
codes, which are generated by the
machine for the results of decimal­
arithmetic operations. There are also
several alternate sign codes (1010, 1110, and 1111 for plus; 1011 for
minus). The alternate sign codes are
accepted by the machine as valid in source operands but are not generated
for results.
Decimal integers may have different lengths, from one to 16 bytes. There
are two decimal formats: packed and
zoned. In the packed format, each byte
contains two decimal digits, except for
the rightmost byte, which contains the
sign code in the right half. For deci­
mal arithmetic, the number of decimal digits in the packed format can vary
from one to 31. Because decimal inte­
gers must consist of whole bytes and
there must be a sign code on the right,
the number of decimal digits is always
odd. If an even number of significant
digits is desired, a leading zero must
be inserted on the left.
In the zoned format, each byte consists
of a decimal digit on the right and the
zone code 1111 (F hex) on the left,
except for the rightmost byte where the
sign code replaces the zone code. Thus,
a decimal integer in the zoned format
can have from one to 16 digits. The
zoned format may be used directly for
input and output in the extended
binary-coded-decimal interchange code (EBCDIC), except that the sign must be
separated from the rightmost digit and
handled as a separate character. For
positive (unsigned) numbers, however,
the sign can simply be represented by
the zone code of the rightmost digit
because the zone code is one of the
acceptable alternate codes for plus.
In either format, negative decimal inte­
gers are represented in true notation
with a separate sign. As for binary
integers, the radix point (decimal
point) of decimal integers is considered
to be fixed at the right, and any scal­
ing is done by the programmer.
The following are some examples of deci­
mal integers shown in hexadecimal nota­
tion: Decimal Packed Zoned Value Format Format
+123 12 3C F1 F2 C3 or or
12 3F F1 F2 F3
-4321 04 32 1D F4 F3 F2 D1 +000050 00 00 05 OC FO FO FO FO F5 CO or or 00 00 05 OF FO FO FO FO F5 FO -7 7D D7 00000 00 00 OC FO FO FO FO CO or or 00 00 OF FO FO FO FO FO Under some circumstances, a zero with a
minus sign (negative zero) is produced.
For example, the multiplicand: 00 12 3D (-123)
times the multiplier: OC (+0) generates the product: 00 00 OD (-0) because the product sign follows the
algebraic rule of signs even when the
value is zero. A negative zero,
however, is equivalent to a positive
zero in that they compare equal in a
decimal comparison.
FLOATING-POINT NUMBERS
A floating-point number is expressed as
a hexadecimal fraction multiplied by a
separate power of 16. The term floating
point indicates that the placement, of
the radix (hexadecimal) point, or scal­
ing, is automatically maintained by the
machine.
The part of a floating-point number
which represents the significant digits
of the number is called the fraction. A
second part specifies the power (expo­
nent) to which 16 is raised and indi­
cates the location of the radix point of
the number. The fraction and exponent
may be represented by 32 bits (short
format), 64 bits (long format), or 128
bits (extended format).
Short Floating-Point Number
IsICharacter;st;cI6-D;9;t o 1 8 31
Appendix A. Number Representation and Instruction-Use Examples A-5
long Floating-Point Number IsICharacter;st;cl 14-D;9;t:Fract;on o 1 8 63
Extended Floating-Point Number High-Order Part High-Order leftmost 14 Digits
Characteristic of 28-Digit Fraction o 1 8 63 low-Order Part low-Order Rightmost 14 Digits
Characteristic of 28-Digit Fraction 64 72 127
A floating-point number has two signs:
one for the fraction and one for the
exponent. The fraction sign, which is
also the sign of the entire number, is the leftmost bit of each format (0 for
plus, 1 for minus). The numeric part of
the fraction is in true notation regard­
less of the sign. The numeric part is
contained in bits 8-31 for the short
format, in bits 8-63 for the long
format, and in bits 8-63 followed by
bits 72-127 for the extended format.
The exponent sign is obtained by
expresslng the exponent in excess-64
notation; that is, the exponent is added
as a signed number to 64. The resulting
number is called the characteristic. It is located in bits 1-7 for all formats.
The characteristic can vary from a to
127, permitting the exponent to vary
from -64 through a to +63. This
provides a scale multiplier in the range
of 16-
64
to 16+
63
A nonzero fraction,
if normalized, has a value less than one
and greater than or equal to 1/16, so 1.0 =
+1/16x16
1
= a 100 0001 0.5 =
+8/16x16° = a 100 0000 1/64 =
+4/16x16-
1
= 0 all 1111 0.0 = +0 x16-
64
= a 000 0000 -15.0 = -15/16x16
1
=
1 100 0001 5.4x10-
79
,.., +1/16x16-
64
= a 000 0000 7.2x1075 ,.., (1-16-
6
)x16
63
= 0 111 1111
that the range covered by the magnitude
M of a normalized floating-point number is:
In decimal terms: 16-
65
is approximately 5.4 x 10-
79
16
63
is approximately 7.2 x 10
75
More precisely,
In the short format:
In the long format:
16-
65 M (1 -16-
14
) x 16
63
In the extended format:
16-
65 M (1 -16-
28
) x 16
63
Within a given fraction length (6, 14,
or 28 digits), a floating-point opera­
tion will provide the greatest precision
if the fraction is normalized. A frac­
tion is normalized when the leftmost
digit (bit positions 8, 9, 10, and 11)
is nonzero. It is unnormalized if the
leftmost digit contains all zeros. If normalization of the operand is
desired, the floating-point instructions
that provide automatic normalization are
used. This automatic normalization is
accomplished by left-shifting the frac­ tion (four bits per shift) until a
nonzero digit occupies the leftmost
digit position. The characteristic is
reduced by one for each digit shifted.
The following figure illustrates sample
normalized short floating-point numbers.
The last two numbers represent the smal­
lest and the largest positive normalized
numbers. 0001 0000 0000 0000 0000 00OO{2} 1000 0000 0000 0000 0000 0000{2} 0100 0000 0000 0000 0000 0000{2} 0000 0000 0000 0000 0000 OOOO{2} 1111 0000 0000 0000 0000 0000{2} 0001 0000 0000 0000 0000 0000{2} 1111 1111 1111 1111 1111 1111{2}
[The symbol"" means "approximately equal."]
Normalized Short Floating-Point Numbers
A-6 System/370 Principles of Operation
Previous Page Next Page