ewan.b...@aurecongroup.com wrote:
> Thanks to all for the suggestions and information.
> The consensus confirm what I thought: that the issue raised was
> most likely poor coding on the part of the original programmer;
> and that compilers in the early 1970s were not set up to realize
> that if you had a DBLE() fronting an expression, the compiler
> should declare a double-precision mode implicitly.
I don't think that they can do that. Well, maybe, but it would
be pretty strange. Until recently, though, the warning was unusual.
(snip)
> Several responders raised the suggestion that compiler options might
> have been set to explicitly force all real variables to be
> double-precision instead of single-precision: this is an
> interesting possibility. Only a few of the routines need to
> use double precision and I think that all the double-precision
> variables in those routines that have external interfaces are
> explicitly defined as double precision, both in the routines that
> calculate with double precision and in the routines that call them.
Well, as usual with separate compilation, you can have different
compiler options for different routines. Also, the 60 bit CDC
machines confused things, as most routines that were double
precision on other machines ran single on CDC machines.
In that case, though, there is no use for DBLE. If all REAL
variables were double precision, then there would be no need
for the DBLE. Even so, there is no need, as the result will
be converted before the assignment. DBLE is usually used for
subroutine and function arguments, to match the type declared
in the called routine. (Or, as noted, with a compiler option.)
> So my uninformed speculation (I am dreaming this theory up as
> I'm typing) is that they might have compiled object files for
> the routines where they wanted every real to be a double with
> a suitable compiler option to force double-precision; then
> compiled the other routines without that option.
Yes, they could have done that.
> Speed was definitely of the essence back in the mid 1970s,
> so I can't see them forcing double precision for all routines.
> I will compile a set of object files and check whether the
> resulting mix of "default-single" and "default-double" object
> files could be linked into one executable and see what difference
> it makes to the results, then compare it to the results from the
> SES v4.1 executable distributed by US DoT in 2002.
For callable subroutines and functions, it was not unusual to
compile both a single precision (often named starting with S)
and double precision (starting with D). In that case, using the
compiler option would make it very easy, though you still have
to change the name.
But still no need for DBLE.
> The outcome of the tests I've outlined above will be of zero
> interest to anyone except ventilation engineers who have to
> modify SES, so I won't post any follow ups here in
> comp.lang.fortran unless there are major effects, something
> like a 1 degree Celsius change in PM peak hour temperatures.
> But any future readers who come across this thread while
> grappling with SES may be able to get some advice - or at
> least a sympathetic ear - by getting in touch with me directly.
You might post one more in the end. People like to know the
ending of the story. But yes, it seems likely that the result
of that expression, despite the DBLE, was stored in single precision.
That the results were close enough, and the error was never noticed
until now.
It is actually fairly rare that results are needed to double precision,
but more often that intermediate values need the precision such that the
final result comes out close enough. (There are no air conditioning
systems accurate to 0.000000000000001 degreee C.)
-- glen