Floating-point arithmetic simplifies programming by
automatically maintaining binary point placement
( scaling) during computations in which the range of
values used vary widely or are unpredictable.
The key to floating-point data representation is the
separation of the significant digits of a number from
the size (scale) of the number. Thus, the number is
expressed as a fraction times a power of 16.
A floating-point number has two associated sets of
values. One set represents the significant digits of the
num ber and is called the fraction. The second set
specifies the power (exponent) to which 16 is raised
and indicates the location of the binary point of the
number.
These two numbers (the fraction and exponent) are
recorded in a single word or double-word. Since each of these two numbers is signed, some
method must be employed to express two signs in an
area that provides for a single sign. This is accom­ plished by having the fraction sign use the sign associ­ ated with the word (or double word) and expressing
the exponent in excess 64 arithmetic; that is, the ex­ ponent is added as a signed number to 64. The result­ ing number is called the charactcristic. Since 64 uses 7
bits, the characteristic can vary from 0 to 127, permit­ ting the exponent to vary from -64 through 0 to +63.
This provides a decimal range of n x 10
75
to n x 10-
78
Floating-point data in the System/360 may be re­ corded in short or long formats, depending on the
precision required. Both formats use a sign bit in bit
position 0, followed by a characteristic in bit positions
1-7. Short-precision floating-point data operands con­ tain the fraction in bit positions 8-31; long-precision
operands have the fraction in bit positions 8-63.
Short-Precision Floating-Point Format Is I Characteristic I Fraction
o 1 7 8 31
Long-Precision Floating-Point Format _________ F_ra_c_ti_o_n ______ ____ o 1 7 8 63
The sign of the fraction is indicated by a zero or one
bit in bit position 0 to denote a positive or negative
fraction, respectively.
Appendix C. Floating-Point Arithmetic
Within a given fraction length (24 or 56 bits), a
floating-point operation will provide the greatest pre­ cision if the fraction is normalized. A fraction is nor­ malized when the high-order digit (bit positions 8,
9, 10 and 11) is not zero. It is unnormalized if the
high-order digit contains all zeros.
If normalization of the operand is desired, the float­ ing-point instructions that provide automatic normal­ ization are used. This automatic normalization is ac­ complished by left-shifting the fraction (four bits per
shift) until a nonzero digit occupies the high-order
digit position. The characteristic is reduced by one for
each digit shifted. Conversion Example Convert the decimal number 149.25 to a short-preci­
sion floating-point operand.
1. The number is decomposed into a decimal integer
and a decimal fraction.
149.25 149 plus 0.25 2. The decimal integer is converted to its hexadeci­
mal representation.
14910
3. The decimal fraction is converted to its hexadeci­
mal representation. 0.2510 4. Combine the integral and fractional parts and ex­ press as a fraction times a power of 16 (exponent).
95.4]6 (0.954 X 16
2
ha
5. The characteristic is developed from the expon­ ent and converted to binary.
base + exponent characteristic
64 + 2 = 66 = 1 0 0 0 0 1 0 6. The fraction is converted to binary and grouped
hexadecimally. .95410 = .1001 0101 0100 7. The characteristic and the fraction are stored in
short precision format. The sign position contains the
sign of the fraction.
S Char Fraction
o 1000010 100101010100000000000000 Appendix C 133
The following are sample normalized short floating­
point numbers. The last two numbers represent the
smallest and the largest positive normalized numbers.
NUMBER POWERS OF 16 S CHAR FRACTION 1.0 -- +1116 X 16
1 =0 1000001 0001 0000 0000 0000 0000 0000 0.5 +8/16 X 16° =0 1000000 1000 0000 0 000 0000 0000 0000 1164 +4/16 X l6-
1 =0 0111111 a 100 0000 0000 0000 0000 0000 0.0 -- +0 x l6-
61
=0 0000000 0000 0000 0000 0000 0000 0000 -15.0 -- -15/16 X 16
1
=1 1000001 1111 0000 0000 0000 0000 0000 2 X 10-
78
-- +1116 x l6-
61
=0 0000000 0001 0000 0000 0000 0000 0000 7 X 10
75
-- (1-16-
6
) X 16
63 =0 1111111 11111111 1111111111111111
134
Previous Page Next Page