This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: double precision fortran??


>I think the problem is that older versions of g77 (I am using 0.5.19.1) 
>handle things like
>
>      double precision foo
>      data foo /3.14159265358979/
>
>by first constructing a single precision number (if you just look at
>the number, there is nothing to tell you that it should be double),
>then initializing the double variable foo with that.  I seem to
>remember some heated debates on comp.lang.fortran about what the
>proper interpretation should be.  In any case, I'd guess that g77's
>default behavior has changed.

You're correct about the behavior of g77 circa 0.5.19.1; however
that behavior still is not only the default, there's no other
choice g77 offers.  As of 0.6, or soon after, g77 will probably offer
widest-need evaluation with a choice of whether named constants
are themselves widest-need evaluated.

But the likelihood of g77's default changing in this area is
pretty low.  It's a tough choice, though; "just this side" (on
the conforming-to-the-spirit-of-the-standard side, that is) as
compared to treating backslashes in character/hollerith
constants specially, which is "just that side", barely.

All because g77 is trying to do two things: be all things to all
people, but also be a "drop-in" replacement (to some reasonable
extent) for classic UNIX `f77'.

And, apparently, *most* classic UNIX `f77' compilers have defaulted
to widest-need evaluation for years, despite the lack of a
complete specification for what that is, AFAIK.  (I've seen a
pretty decent near-complete *proposal*, however, by Robert Corbett,
but it leaves important questions unanswered.)

I have asked, once that I can recall, whether people have opinions
regarding changing the default behavior of g77 in this area down
the road, and the only response I got was a lengthy, detailed
"NO!" from one person.

The upshot is that, for now, you have to write

	data pi/3.1519626535D0/

in g77 Fortran to get the double precision for pi (assuming it, too,
is double precision, of course).  Someday g77 might offer a choice,
but probably not as a default.

        tq vm, (burley)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]