SCOUG-Programming Mailing List Archives
Return to [ 10 |
August |
2003 ]
<< Previous Message <<
>> Next Message >>
Content Type: text/plain
Lynn H. Maxson writes:
> That results, for example, PL/I declaring binary and decimal
> floating point variables as "dcl S binary float(16);" and "dcl T
> decimal float(5)". To quote from the language reference
> manual for decimal floating point: "If the declared precision is
> less than or equal to (6), short floating-point form is used. If
^^^^^^^^^^^^^^^^^^^^^^^^^
> the declared precision is greater than (6) and less than or
> equal to (16), long floating-point form is used. If the declared
^^^^^^^^^^^^^^^^^^^^^^^^
> precision is greater than (16), extended floating-point form is
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> used."
>
> Note that it allows any value for precision within those ranges
> as well a allowing the programming to designate either binary
> or decimal. Something similar is true for fixed-point binary
> and decimal, noting that either support an integer or real
> (fractional portion).
In other words, the compiler implementors got to the language
lawyers and had them insert some 7-point type in the language
specification. So as far as the distinction between the C
"float" and the PL/I "decimal float(5)" -- surprise, there is
none on many implimentations! The compiler writer is free to
use the machine's native floating point representation -- No
matter how broken it might be. (Subtle jab at the S/360
architecture.)
When I was in college here in California, I learned Fortran
on 24- and 36- bit machines. (Yes, I said thirty-SIX bits.)
Also, very few of my teachers had any industrial experience.
As a result, I was exposed to all kinds of folklore, fables,
suppositions, urban legends, etc. about REAL versus DOUBLE
PRECISION for scientific software. It broke down to two camps:
Camp 1: REAL is just fine for everything scientific,
DOUBLE PRECISION is wastefull overkill.
Camp 2: REAL variables SUX for scientific computing,
DOUBLE PRECISION is absolutely necessary for
any serious scientific work.
Fortunately, my first job out of college was at a National
Lab that ran an S/360 shop. The mathematicians and computer
scientists did a good job making sure that the other scientists
and engineers had a chance to learn how to effectively use
the computer. As it turns out, the specification that Lynn
cites above has absolutely nothing to say about a major factor
affecting floating point representations: RADIX.
After a few years at the National Lab, I went back to graduate
school. And at the university in New York, the REAL versus
DOUBLE PRECISION mythology continued on with the computer center
having two IBM 4341's and a DEC PDP-10.
PDP-10: REAL --> 36-bit, binary radix
DOUBLE PRECISION --> 72-bit, binary radix
4341: REAL --> 32-bit, hexadecimal radix
DOUBLE PRECISION --> 64-bit, hexadecimal radix
This time, howeever, I had enough understanding to explain to
my faculty advisor WHY the REAL data type on the 4341 was not
suited to my project. I was also able to write quick and dirty
example programs to show why I should use DOUBLE PRECISION on
the 4341. So to re-phrase my jab at the S/360, the floating point
REAL data type on the 4341 was not for me -- not that it SUX --
but because it uses a hexadecimal radix. There is a design trade-
off between dynamic range and precision that the declaration
"dcl T float decimal(6);" completely misses.
Well, one more meander in the river of discourse.
--
Gregory W. Smith (WD9GAY) gsmith@well.com
=====================================================
To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".
For problems, contact the list owner at
"rollin@scoug.com".
=====================================================
<< Previous Message <<
>> Next Message >>
Return to [ 10 |
August |
2003 ]
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|