CHAPTER FLOATING-POINT INSTRUCTIONS Floating-Point Number Representation •....•••••..•••.•••.•. 9-1
Normalization •..•••.•••.•••.•.•••..•••...••.•..••.•.••..•. 9-2
Floating-Point-Data Format •••.•...•••..•.••.•.•.•••••.•••• 9-2
Instructions ....•.•.•••..•••....•••••••..•.•.•.•••.••.•••. 9-4
ADD NORMAL IZED •...•...•....••.•••..•...••.•..••.•...•••• 9-6
ADD UNNORMALIZED •...•.••........•..•....•......•........ 9-7 COMPARE ...•.....•••.•••••••••.•••......•.•.••.••••..••.. 9-8
DIVIDE ......••..•••.••.•..••..•..••....••...••.••..•••.. 9-9
HALVE ........•..•....•..••...••....•...•.••••..•...•.•.• 9-10 LOAD .............•..............•.•....••.•......••...•• 9-10 LOAD AND TEST .••..••..•.•.•..••...•....•.•••.•.•••.•••.. 9-11 LOAD COMPLEMENT .•••...•..•..••.••.•.••.•..•••.••.•.•.•.• 9-11 LOAD NEGATIVE .•...................•....•...•...•...•..•. 9-11 LOAD POSITIVE .•....•...................•....••.....•.... 9-12 LOAD ROUNDED •..•.....•..••.........•....•............... 9-12 MULTIPLY ....•.•.•.......•.........•....•.••.•.•..•...••. 9-13 STORE ...............••.•.•.•....•.•.....•.....•......... 9-14
SUBTRACT NORMALIZED .............•......•..••.•.•.•.••••. 9-14 SUBTRACT UNNORMALIZED .............•..•....••..•..•...... 9-15
Floating-point instructions are used to
perform calculations on operands with a
wide range of magnitude and to yield
results scaled to preserve precision.
The floating-point instructions provide
for loading, rounding, adding, subtract­
ing, comparing, multiplying, dividing,
and storing, as well as controlling the sign of short, long, and extended oper­
ands. Short operands generally permit
faster processing and require less stor­
age than long or extended operands. On the other hand, long and extended oper­
ands permit greater precision in
computation. Four floating-point regis­
ters are provided. Instructions may
perform either register-to-reglster or
storage-and-register operations.
Most of the instructions generate
normalized results, which preserve the
highest precision in the operation. For
addition and subtraction, instructions
are also provided that generate unnor­
mali zed results. Either normalized or
unnormalized numbers may be used as
operands for any floating-point opera­
tion.
The rounding and extended-operand in­ structions are part of the extended­
precision floating-point facility. The
other floating-point instructions and
the floating-point registers are part of
the floating-point facility. FLOATING-POINT NUMBER REPRESENTATION A floating-point number consists of a
signed hexadecimal fraction and an
unsigned seven-bit binary integer called
the characteristic. The characteristic
represents a signed exponent and is obtained by adding 64 to the exponent
value (excess-64 notation). The range
of the characteristic is 0 to 127, which corresponds to an exponent range of -64
to +63. The value of a floating-point
number is the product of its fraction
and the number 16 rai.sed to the power of
the exponent which is represented by its
characteristic.
The fraction of a floating-point number
is treated as a hexadecimal number
because it is considered to be multi­
plied by a number which is a power of
16. The name, fraction, indicates that
the radix point is assumed to be imme­
diately to the left of the leftmost
fraction digit. The fraction is repres­
ented by its absolute value and a separate sign bit. The entire number is
positive or negative, depending on
whether the sign bit of the fraction is
zero or one, respectively.
When a floating-point operation would
cause the result exponent to exceed 63,
the characteristic wraps around from 127
to 0, and an exponent-overflow condition
exists. The result characteristic is
then too small by 128. When an opera­
tion would cause the exponent to be less
than -64, the characteristic wraps
around from 0 to 127, and an exponent­
underflow condition exists. The result
characteristic is then too large by 128,
except that a zero characteristic is produced when a true zero is forced.
A true zero is a floating-point number
with a zero characteristic, zero frac­
tion, and plus sign. A true zero may Chapter 9. Floating-Point Instructions 9-1
arise as the normal result of an arith­
metic operation because of the partic­
ular magnitude of the operands. The
result is forced to be a true zero when:
1. An exponent underflow occurs and
the exponent-underflow mask bit in
the PSW is zero,
2. The result fraction of an addition
or subtraction operation is zero
and the significance mask bit in
the PSW is zero, or
3. The operand of the HALVE instruc­
tion, one or both operands of the MULTIPLY instruction, or the divi­
dend in the DIVIDE instruction has a zero fraction.
When a program interruption for exponent
underflow occurs, a true zero is not
forced; instead, the fraction and sign
remain correct, and the characteristic
is too large by 128. When a program
interruption for significance occurs,
the fraction remains zero, the sign is
positive, and the characteristic remains
correct.
The sign of a sum, difference, product,
or quotient with a zero fraction is
positive. The sign of a zero fraction
resulting from other operations is
established from the operand sign, the
same as for nonzero fractions. NORMALIZATION A quantity can be represented with the
greatest precision by a floating-point
number of a given fraction length when
that number is normalized. A normalized
floating-point number has a nonzero
leftmost hexadecimal fraction digit. If
one or more leftmost fraction digits are
zeros, the number;s said to be unnor­
malized.
Unnormalized numbers are normalized by
shifting the fraction left, one digit at
a time, until the leftmost hexadecimal
digit is nonzero and reducing the char­
acteristic by the number of hexadecimal
digits shifted. A number with a zero
fraction cannot be normalized; its char­
acteristic either remains unchanged, or
it is made zero when the result is
forced to be a true zero.
Addition and subtraction with extended
operands, as well as the MULTIPLY, DIVIDE, and HALVE operations, are
performed only with normalization.
Addition and subtraction with short or
long operands may be specified as either
normalized or unnormalized. For all
other operations, the result is produced
without normalization.
9-2 System/370 Principles of Operation
With unnormalized operations, leftmost
zeros in the result fraction are not
eliminated. The result mayor may not
be in normalized form, depending upon
the original operands.
In both normalized and unnormalized
operations, the initial operands need
not be in normalized form. The operands
for multiplication and division are
normalized before the arithmetic
process. For other normalized oper­
ations, normalization takes place when
the intermediate arithmetic result is
changed to the final result.
When the intermediate result of
addition, subtraction, or rounding caus­
es the fraction to overflow, the frac­
tion is shifted right by one
hexadecimal-digit position and the value
one is supplied to the vacated leftmost
digit position. The fraction is then
truncated to the final result length,
while the characteristic is increased by
one. This adjustment is made for both
normalized and unnormalized operations. Programming Note
Up to three leftmost bits of the frac­
tion of a normalized number may be
zeros, since the nonzero test applies to
the entire leftmost hexadecimal digit. FLOATING-POINT-DATA FORMAT
Floating-point numbers have a 32-bit
(short) format, a 64-bit (long) format,
or a 128-bit (extended) format. Numbers
in the short and long formats may be
designated as operands both in storage
and in the floating-point registers,
whereas operands having the extended
format can be designated only in the
floating-point registers.
The floating-point registers contain 64
bits each and are numbered 0, 2, 4, and
6. A short or long floating-point
number requires a single floating-point
register. An extended floating-point
number requires a pair of these regis­
ters: either registers 0 and 2 or
registers 4 and 6; the two register
pairs are designated as 0 or 4, respec­
tively. When the R! or R2 field of a
floating-point instruction designates
any register number other than 0, 2, 4,
or 6 for the short or long format, or
any register number other than 0 or 4
for the extended format, a program
interruption for specification exception
occurs.
Previous Page Next Page