T.R | Title | User | Personal Name | Date | Lines |
---|
3212.1 | Alpha floating point details | PACKED::BRAFFITT | | Mon Mar 10 1997 06:48 | 37 |
| > My customer wants to know how many bits are assigned for exponent and
> fractional part of comp-1. Also, if he use /float=d_float or
> /float=g_float during compiling cobol source, please inform me about
> each case's bits assignment for comp-2.
These details are combined from material in
Alpha Architecture Handbook 1992 pp. 2-3 - 2-9
DEC COBOL Reference Manual pp. 5.141 - 5.142
DEC COBOL User Manual Compatibility Appendix
Alpha Exponent Fraction Approximate DEC COBOL
Datatype Bits Bits Decimal Digits Qualifier
--------------------------------------------------------------------
COMP-1 F_floating 8 24 7 /FLOAT=D or G
COMP-2 G_floating 11 53 15 /FLOAT=G
COMP-2 D_floating 11 53 16 /FLOAT=D
COMP-1 S_floating 8 23 * /FLOAT=IEEE
COMP-2 T_floating 11 52 * /FLOAT=IEEE
* Not specified in Alpha Architecture Handbook
Note that with F_, D_, and G_, the redundant most significant
fraction bit is not represented.
"D_floating is not a fully supported data type; no D_floating
arithmetic operations are provided in the architecture ...
D_floating 'format compatibility' in which binary files of
D_floating numbers may be processed, but without the last
3 bits of fraction precision, can be obtained by conversions
to G_floating, G arithemetic operations, then conversions
back to D_floating."
Note that /FLOAT=D is the default with DEC COBOL on OpenVMS Alpha
for partial (but not 100%) compatibility with VAX COBOL. /FLOAT=D and
/FLOAT=G are not available on other supported DEC COBOL platforms
where /FLOAT=IEEE is the DEC COBOL default.
|
3212.2 | F & S are similar; G & T are similar | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Mon Mar 10 1997 09:47 | 17 |
| Don, which of those references suggests that S has fewer fraction
bits than F, and that T has fewer fraction bits than G? In fact,
the formats are very similar within these pairs.
F and S both have an 8-bit exponent, and both use a 24-bit fraction
with the leading bit suppressed, to occupy 23 bits in storage. That
leaves 1 bit for the sign (8+23+1=32). These formats provide about
7 decimal digits of precision. They differ in how the bits are
ordered, how the exponent is represented, and the exact endpoints of
the range of representable numbers.
G and T both have an 11-bit exponent, and both use a 53-bit fraction
with the leading bit suppressed, to occupy 52 bits in storage. That
leaves 1 bit for the sign (11+52+1=64). These formats provide about
15 decimal digits of precision. They differ in how the bits are
ordered, how the exponent is represented, and the exact endpoints of
the range of representable numbers.
|
3212.3 | Quotes from 1992 Alpha Architecture Handbook | PACKED::BRAFFITT | | Mon Mar 10 1997 11:15 | 13 |
| >Don, which of those references suggests that S has fewer fraction
>bits than F, and that T has fewer fraction bits than G? In fact,
>the formats are very similar within these pairs.
The Alpha Architecture Handbook 1992:
p. 2-4 D-floating - "normalized 24-bit fraction"
p. 2-5 G-floating - "normalized 53-bit fraction"
p. 2-8 S-floating - "23-bit fraction"
p. 2-9 T-floating - "52-bit fraction"
and it explains the details about the redundant most significant
fraction bit not being represented for D/G.
|
3212.4 | More Questions | DEKVC::JOONGSUNJUN | | Tue Mar 11 1997 04:58 | 40 |
| Hi,
Thank you for your help. Please see some more questions and advise me.
>> Alpha Exponent Fraction Approximate DEC COBOL
>> Datatype Bits Bits Decimal Digits Qualifier
>> --------------------------------------------------------------------
>> COMP-1 F_floating 8 24 7 /FLOAT=D or G
>> COMP-2 G_floating 11 53 15 /FLOAT=G
>> COMP-2 D_floating 11 53 16 /FLOAT=D
Q1. Dose "Approximae Decimal Digits" mean that it is recommanded
for my customer only to use 7, 15, or 16 bytes for numerice data ?
For instance,
77 float_num comp-2. ! (/float=D)
77 num_string pic s9(x)v9(y).
move float_num to num_string.
Dose my customer need to define total number of bytes for x and y
as only 16 for precision of numeric data ? That is, s9(10)v9(6),
or s9(3)v9(13) comp, etc only provides precise numeric data ?
>> Note that with F_, D_, and G_, the redundant most significant
>> fraction bit is not represented.
Q2. Does this imply, for example, 24 fraction bits include 1 sign bit ?
>> "D_floating is not a fully supported data type; no D_floating
>> arithmetic operations are provided in the architecture ...
Q3. Does this mean that G float is better than D float for my customer
to increase data precision and performance on DEC COBOL, Alpha/
OpenVMS ?
Best Regards,
Joong-Sun Jun.
|
3212.5 | | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Tue Mar 11 1997 09:47 | 31 |
| Q1. Dose "Approximae Decimal Digits" mean that it is recommanded
for my customer only to use 7, 15, or 16 bytes for numerice data ?
This means that a COMP-1 can represent numbers to approximately 1 part in 10,000,000.
Nothing should go wrong if you convert COMP-1 to, say, PIC 9(18), but digits after
the most significant 6 or 7 may not have the values you expect. Similarly for COMP-2
and 15 or 16 digits.
Q2. Does this imply, for example, 24 fraction bits include 1 sign bit ?
The storage for F_float and S_float contains
1 sign bit
8 exponent bits
23 fraction bits, representing all but the leading '1' of a
24-bit fraction. (The leading bit is always '1' because
the fraction is normalized, so it doesn't need to be
stored. The only exception is when the exponent field
is all zero.)
Q3. Does this mean that G float is better than D float for my customer
to increase data precision and performance on DEC COBOL, Alpha/
OpenVMS ?
Performance for G_float could be slightly better, since you avoid the cost
of converting between D and G when loading and storing. The precision for
the two formats is the same, since D arithmetic is all done in G format.
G_float provides a greater range (about 1e-300..1e300) than D_float (about
1e-38..1e38). Pick the format that's compatible with the files you need
to process, or with software you need to call (such as databases). If that
doesn't decide it, I would be tempted to use G, even though the default is
D for compatibility with VAX COBOL.
|